kmjp's blog

競技プログラミング参加記です

April Fools Day Contest 2014 : D. Big Data、E. Dome、F. 000001

また変な問題…。
http://codeforces.com/contest/409/problem/D
http://codeforces.com/contest/409/problem/E
http://codeforces.com/contest/409/problem/F

D. Big Data

16個の文章が与えられる。
入力値1~16に対し出力を返せ。

文章の真偽に対し1・0を返せばよい。

  1. The highest mountain above sea level in the world is Mount Everest. Its peak rises to 8848 m.
    • 正解(1)
  2. The largest board game tournament consisted of 958 participants playing chapaev.
    • 不正解(0)、43,157名。
  3. The largest online maths competition consisted of 12766 participants.
    • 不正解(0)、1,204,766 名。
  4. The Nile is credited as the longest river in the world. From its farthest stream in Burundi, it extends 6695 km in length.
    • 正解(1)
  5. While not in flood, the main stretches of the Amazon river in South America can reach widths of up to 1100 km at its widest points.
    • 不正解(0)。出典によるが500km位。
  6. Angel Falls is the highest waterfall. Its greatest single drop measures 807 m.
    • 正解(1)
  7. The Hotel Everest View above Namche, Nepal — the village closest to Everest base camp – is at a record height of 31962 m
    • 不正解(0)、エベレストに上る途中にあるのに高度31962mなんておかしい。
  8. Uranium is the heaviest of all the naturally occurring elements. Its most common isotope has a nucleus containing 146 neutrons.
    • 正解(1)
  9. The coldest permanently inhabited place is the Siberian village of Oymyakon, where the temperature of -68°C was registered in the twentieth century.
    • 正解(1)
  10. The longest snake held in captivity is over 25 feet long. Its name is Medusa.
    • 正解(1)

Colonel Meow holds the world record for longest fur on a cat — almost 134 centimeters.

    • 不正解(0)、23cm弱。
  1. Sea otters can have up to 10000 hairs per square inch. This is the most dense fur in the animal kingdom.
    • 不正解(0)、150000/cm^2なので1000/inch^2よりも密度が高い。
  2. The largest state of USA is Alaska; its area is 663268 square miles
    • 正解(1)

Alaska has a longer coastline than all of the other 49 U.S. States put together: it is 154103 miles long.

    • 不正解(0)、34000マイル程度。

Lake Baikal is the largest freshwater lake in the world. It reaches 1642 meters in depth and contains around one-fifth of the world’s unfrozen fresh water.

    • 正解(1)

The most colorful national flag is the one of Turkmenistan, with 106 colors.

    • 不正解(0)、そもそもトルクメニスタンではなくエクアドル。
void solve() {
	int f,i,j,k,l,x,y;
	int R[]={1,0,0,1,0,1,0,1,1,1,0,0,1,0,1,0};
	cin>>x;
	cout << R[x-1] << endl;
}

E. Dome

実数が与えられるので2つの値を返せ。

テストケースとサンプル図より、底辺が1辺aの正方形、高さがhの四角錘に内接する半球の半径が与えられていることがわかる。
aとhの候補は少ないので、総当たりで半径が一致するa,hを答えればよい。

なお、立体図形問題だが実際は縦に半分に切れば、二等辺三角形に内接する半円を求める2次元の問題になる。
ちなみに半径は \frac{ah}{2\sqrt{h^2+(\frac{a}{2})^2}}

void solve() {
	int f,i,j,k,l,x,y;
	double A;
	cin>>A;
	for(x=1;x<=10;x++) for(y=1;y<=10;y++) {
		double hh=y*x/2.0/sqrt(y*y+x*x/4.0);
		if(fabs(hh-A)<1e-5) return _P("%d %d\n",x,y);
	}
}

F. 000001

入力値1~64が与えられるので出力を返せ。

A000001 - OEISだったようだ。こんなんわからんよ…。

int A[]={0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5,
         1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14,
         1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15,
         2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50,
         1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2};
void solve() {
	int f,i,j,k,l,x,y;
	cin>>x;
	cout << A[x] << endl;
}

まとめ

Eが普通な感じで一番おもしろかった。
DはまだしもFは微妙。