C - 風力観測 / AtCoderBeginnerContest #001

abc001.contest.atcoder.jp

#include <cmath>
#include <iostream>
using namespace std;

#define EPS 1e-5

void Solve(double deg, double dis)	{
	const string name_wind[17]={"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N"};
	const double power_wind[13]={0.0, 0.3, 1.6, 3.4, 5.5, 8.0, 10.8, 13.9, 17.2, 20.8, 24.5, 28.5, 32.7};
	int dir=(deg+11.25)/22.5, w;

	dis*=10;
	dis=floor(dis);
	dis/=10;
	for (w=0; w<13-1; ++w)
		if (dis < power_wind[w+1])	break;
	if (!w)	cout << "C" << " " << w << endl;
	else	cout << name_wind[dir] << " " << w << endl;
}

int main(void)	{
	double deg, dis;

	cin >> deg >> dis;
	Solve(deg/10.0,dis/60+0.05+EPS);
	return 0;
}

問題文に書かれている通り実装、dis*=10からdis/=10までの処理は小数点第二位切り捨て。
EPSを忘れていて何度もWrongAnswer。
~了~