結果
| 問題 |
No.289 数字を全て足そう
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-18 07:58:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 315 bytes |
| コンパイル時間 | 468 ms |
| コンパイル使用メモリ | 56,252 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-08 00:45:16 |
| 合計ジャッジ時間 | 1,261 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <iostream>
#include <string>
int main(){
constexpr const char one = '1';
constexpr const char nine = '9';
std::string S;
std::cin >> S;
int sum = 0;
for(const auto& c : S){
if(one <= c && c <= nine){
sum += c - one + 1;
}
}
std::cout << sum << std::endl;
return 0;
}