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