結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
![]() |
提出日時 | 2017-02-07 16:04:13 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 298 bytes |
コンパイル時間 | 1,659 ms |
コンパイル使用メモリ | 158,292 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 13:08:29 |
合計ジャッジ時間 | 2,560 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> #include <iostream> #include <string> #include <stdlib.h> using namespace std; int main() { string s; cin>>s; int a; int sum=0; for (int i = 0; i < s.length(); ++i) { a=s[i]-48; if(a==1||a==2||a==3||a==4||a==5||a==6||a==7||a==8||a==9){ sum+=a; } } cout<<sum<<endl; }