#include <iostream>
#include <vector>
using namespace std;
int q_before, q_after; // Qp-1, Qp
int P; // 단계를 나타내는 함수
int N; // 총 못의 개수
bool visited[1001][1001];
int main() {
memset(visited, 0, sizeof(visited));
cin >> N;
P = 1;
q_before = 0;
int solution = 0;
for (int i = 0 ; i < N*N; i++) {
q_after = (q_before + P) % N;
if (!visited[q_before][q_after] && !visited[q_after][q_before] && q_after != q_before) {
solution++;
visited[q_before][q_after] = true;
visited[q_after][q_before] = true;
}
P++;
q_before = q_after;
}
cout << solution << endl;
return 0;
}
Compilation message
P.cpp: In function 'int main()':
P.cpp:11:36: error: 'memset' was not declared in this scope