結果
| 問題 | No.257 N言っちゃダメゲーム (3) |
| コンテスト | |
| ユーザー |
kpinkcat
|
| 提出日時 | 2023-11-10 16:38:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 692 bytes |
| コンパイル時間 | 860 ms |
| コンパイル使用メモリ | 102,660 KB |
| 最終ジャッジ日時 | 2025-02-17 20:16:36 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 28 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:31:14: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized]
31 | while (s < n){
| ~~^~~
main.cpp:15:15: note: ‘s’ was declared here
15 | int n, k, s;
| ^
ソースコード
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;
int main(){
int n, k, s;
cin >> n >> k;
if (n >= 3) {
s = (n-2)%k;
if (s == 1) cout << 0 << endl;
else cout << s << endl;
} else if (n == 2) {
cout << 1 << endl;
s = 0;
return 0;
} else if (n == 1) {
cout << 0 << endl;
s = 0;
return 0;
}
while (s < n){
s += k;
int opp;
cin >> opp;
if (opp >= n) return 0;
cout << s << endl;
}
}
kpinkcat