結果
問題 |
No.1168 Digit Sum Sequence
|
ユーザー |
![]() |
提出日時 | 2020-08-17 19:43:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 299 bytes |
コンパイル時間 | 1,696 ms |
コンパイル使用メモリ | 165,120 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 11:14:50 |
合計ジャッジ時間 | 2,582 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | AC * 2 WA * 27 |
コンパイルメッセージ
In function 'int sum(int)', inlined from 'int main()' at main.cpp:16:21: main.cpp:7:13: warning: 'n' is used uninitialized [-Wuninitialized] 7 | while(nn!=0){ | ~~^~~ main.cpp: In function 'int main()': main.cpp:15:9: note: 'n' was declared here 15 | int n; | ^
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int sum(int nn){ int x=0; while(nn!=0){ x+=nn%10; nn/=10; } return x; } int main() { int n; rep(i,100) n=sum(n); cout << n << endl; }