Submission #157690


Source Code Expand

#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
#define EPS 1e-8

string direct[17] = {"N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW","C"};
double strong[12] = {0.2, 1.5, 3.3, 5.4, 7.9, 10.7, 13.8, 17.1, 20.7, 24.4, 28.4, 32.6};

double roundOff( double n ){
	return (double)((int)((n*10)+0.5))/10;
}

int main(){
	int d, w;
	cin >> d >> w;

	int  ans_w = 12;
	for( int i=0; i<12; i++ ){
		if( roundOff((double)w/60)+EPS <= strong[i]+EPS ){
			//cout << (int)(roundOff((double)w/60,2)*10) << endl;
			ans_w = i;
			break;
		}
	}
	int ans_d = (((double)d+112.5) / 225)%16;
	if( ans_w == 0 ) ans_d = 16;
	cout << direct[ans_d] << " " << ans_w << endl;
}

Submission Info

Submission Time
Task C - 風力観測
User shuhei23
Language C++ (G++ 4.6.4)
Score 0
Code Size 745 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:26:40: error: invalid operands of types ‘double’ and ‘int’ to binary ‘operator%’