結果

問題 No.656 ゴルフ
ユーザー leaf+
提出日時 2019-04-14 11:05:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 258 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 56,344 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-17 11:01:41
合計ジャッジ時間 883 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:19: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   10 |         else {ans += s[i];}

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
int main() {
    string s;
    int i, ans;
    cin >> s;
    for (i = 0; i < 9; i++) {
        if (s[i] == '0') {ans += 10;}
        else {ans += s[i];}
    }
    cout << ans << endl;
    return 0;
}
0