Submission #9535

#TimeUsernameProblemLanguageResultExecution timeMemory
9535silasWiring (kriii2_W)C++98
1 / 4
12 ms2652 KiB
#include <iostream> #include <vector> #include <string.h> 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...