답안 #9562

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
9562 2014-09-28T07:17:01 Z dominyellow Wiring (kriii2_W) C++
컴파일 오류
0 ms 0 KB
#include <stdio.h>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

long main(void){
	long N;
	scanf("%d", &N);

	map<long, long> q_map;

	q_map[0] = 0;

	map<pair<long, long>, bool> line_map;

	long line_count = 0;
	long i;
	for(long i=1; i<=N; i++){
		long q_i;
		q_i = (q_map[i-1]+i) % N;
		//prlongf("%d\n", q_i);
		if(q_i == 0){
			//break;
		}
		if(q_map.count(i) == 0){
			q_map[i] = q_i;
		}

		if(q_map[i-1] != q_i){
			if(line_map.count(make_pair(q_map[i-1], q_i)) == 0 && line_map.count(make_pair(q_i, q_map[i-1])) == 0){
				line_map[make_pair(q_map[i-1], q_i)] = true;
				line_count += 1;
			}
		}
	}
	printf("%ld\n", line_count);
	return 0;
}

Compilation message

P.cpp:9:15: error: '::main' must return 'int'
P.cpp: In function 'int main()':
P.cpp:11:16: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long int*' [-Wformat]
P.cpp:20:7: warning: unused variable 'i' [-Wunused-variable]
P.cpp:11:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]