結果
| 問題 |
No.289 数字を全て足そう
|
| コンテスト | |
| ユーザー |
leaf+
|
| 提出日時 | 2019-04-14 11:40:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 248 bytes |
| コンパイル時間 | 413 ms |
| コンパイル使用メモリ | 55,860 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-17 12:20:13 |
| 合計ジャッジ時間 | 1,192 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:13: warning: ‘an’ may be used uninitialized in this function [-Wmaybe-uninitialized]
11 | cout << an << endl;
| ^~
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
int i, an;
cin >> s;
for (i = 0; i < s.length(); i++) {
if (s[i] - '0' < 10) {an += s[i] - '0';}
}
cout << an << endl;
return 0;
}
leaf+