結果

問題 No.656 ゴルフ
ユーザー shioya
提出日時 2018-07-08 18:28:50
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 54,648 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 22:46:30
合計ジャッジ時間 849 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
using namespace std;
int ctoi(char c){
    if(c >='0' && c<='9'){
        return c-'0';
    }
    return -1;
}
int main()
{
    string str;
    cin>>str;
    int score = 0;
    for(int i=0;i<str.length();i++){
        score += ctoi(str[i]);
        if(str[i]=='0'){
            score+=10;
        }
    }
    cout<<score;
    return 0;
}
0