結果
問題 |
No.1168 Digit Sum Sequence
|
ユーザー |
![]() |
提出日時 | 2020-08-17 19:42:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 295 bytes |
コンパイル時間 | 1,821 ms |
コンパイル使用メモリ | 165,248 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 11:14:44 |
合計ジャッジ時間 | 2,554 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | AC * 1 WA * 28 |
コンパイルメッセージ
In function 'int sum(int)', inlined from 'int main()' at main.cpp:16:21: main.cpp:7:12: warning: 'n' is used uninitialized [-Wuninitialized] 7 | while(n!=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 n){ int x=0; while(n!=0){ x+=n%10; n/=10; } return x; } int main() { int n; rep(i,100) n=sum(n); cout << n << endl; }