Submission #121627


Source Code Expand

int main(int argc, char const* argv[])
{
	int n;
	int res_s, res_e;
	int flag = 0;
	cin >> n;
	int time[MAX] = {0};
	for (int i = 0; i < n; i++) {
		string tmp;
		cin >> tmp;
		int s = atoi(tmp.substr(0,4).c_str());
		if (s % 5 != 0) {
			s -= s % 5;
		}
		int e = atoi(tmp.substr(5,8).c_str());
		if (e % 5 != 0) {
			e += 5 - e % 5;
		}
		for (int i = s; i <= e; i++) {
			time[i] = 1;
		}
	}
	for (int i = 0; i < MAX; i++) {
		if (flag == 0 && time[i] == 1) {
			printf("%04d-", i);
			flag = 1;
		}
		if (flag == 1 && time[i] == 0) {
			printf("%04d\n", i - 1);
			flag = 0;
		}
	}
	return 0;
}

Submission Info

Submission Time
Task D - 感雨時刻の整理
User Ryosun
Language C++ (G++ 4.6.4)
Score 0
Code Size 631 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:6:2: error: ‘cin’ was not declared in this scope
./Main.cpp:7:11: error: ‘MAX’ was not declared in this scope
./Main.cpp:9:3: error: ‘string’ was not declared in this scope
./Main.cpp:9:10: error: expected ‘;’ before ‘tmp’
./Main.cpp:10:10: error: ‘tmp’ was not declared in this scope
./Main.cpp:11:39: error: ‘atoi’ was not declared in this scope
./Main.cpp:20:4: error: ‘time’ was not declared in this scope
./Main.cpp:24:20: error: ‘time’ was not declared in this scope
./Main.cpp:25:21: error: ‘printf’ was not declared in this scope
./Main.cpp:28:20: error: ‘time’ was not declared in this scope
./Main.cpp:29:26: error: ‘printf’ was not declared in this scope