AtCoder Beginner Contest 001

Submission #288335

Source codeソースコード

#include <stdio.h>
#include <string>

// 小数点第2位以下を四捨五入する関数
double roundP2(double n){
	int result;
	n = n*10+0.5;
	result = (int)n;
	return (double)result/10;
}

int main(){
	int wp, dig, dis
	double disPerSec;
	double borderWP[12] = {0.3, 1.6, 3.4, 5.5, 8.0, 10.8, 13.9,
								17.2, 20.8, 24.5, 28.5, 32.7};
	std::string dig16[16] = {
						 "N", "NNE", "NE", "ENE",
						 "E", "ESE", "SE", "SSE",
						 "S", "SSW", "SW", "WSW",
						 "W", "WNW", "NW", "NNW"
						 };
	std::string sDig;
	scanf("%d %d", &dig, &dis);
	
	dig += 112.5;
	dig %= 3600;
	sDig = dig16[dig/225];
	
	disPerSec = roundP2(dis/60.0);
	for(wp = 0; wp < 12; wp++){
		if(disPerSec < borderWP[wp])
			break;
	}
	if(wp == 0)
		sDig = "C";
	
	printf("%s %d\n", sDig.c_str(), wp);

	return 0;
}

Submission

Task問題 C - 風力観測
User nameユーザ名 kobokobo
Created time投稿日時
Language言語 C++ (G++ 4.6.4)
Status状態 CE
Score得点 -
Source lengthソースコード長 838 Byte
File nameファイル名
Exec time実行時間 -
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:2: error: expected initializer before ‘double’
./Main.cpp:24:24: error: ‘dis’ was not declared in this scope
./Main.cpp:30:2: error: ‘disPerSec’ was not declared in this scope

Test case