結果
| 問題 | No.415 ぴょん |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-04 23:28:37 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 358 bytes |
| 記録 | |
| コンパイル時間 | 500 ms |
| コンパイル使用メモリ | 78,840 KB |
| 実行使用メモリ | 248,064 KB |
| 最終ジャッジ日時 | 2026-05-10 19:50:01 |
| 合計ジャッジ時間 | 3,376 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 1 TLE * 1 -- * 22 |
ソースコード
#include <iostream>
#include <set>
int n, d;
std::set<int> s;
int cur, cnt;
int main() {
std::cin >> n >> d;
if (d == 1)std::cout << n << std::endl;
else if (d == n - 1)std::cout << n << std::endl;
else {
while (s.find(cur) == s.end()) {
s.insert(cur);
cur = (cur + d) % n;
++cnt;
}
std::cout << cnt - 1 << std::endl;
}
return 0;
}