結果
問題 |
No.1406 Test
|
ユーザー |
|
提出日時 | 2021-02-26 21:24:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 518 bytes |
コンパイル時間 | 1,568 ms |
コンパイル使用メモリ | 167,316 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-02 13:53:24 |
合計ジャッジ時間 | 2,328 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 22 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:21:16: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 21 | ans++; | ~~~^~ main.cpp:18:9: note: 'ans' was declared here 18 | int ans; | ^~~ main.cpp:16:9: warning: 's' may be used uninitialized [-Wmaybe-uninitialized] 16 | int s; | ^
ソースコード
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define ll long long int main(){ int n; cin >> n; if (n == 1){ cout << 100 << endl; return 0; } vector<int> a(n-1); rep(i, n-1) cin >> a[i]; int s; rep(i, n-1) s += a[i]; int ans; rep(i, 101){ if ((s+i)%n == 0){ ans++; } } cout << ans << endl; }