結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
![]() |
提出日時 | 2018-01-22 01:16:46 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 406 bytes |
コンパイル時間 | 648 ms |
コンパイル使用メモリ | 69,148 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 21:59:48 |
合計ジャッジ時間 | 1,365 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<cmath> #include<math.h> #include<iomanip> #include<stdio.h> #include<cstring> using namespace std; int main(){ int ans=0; string s; string num="123456789"; cin >> s; for(int i=0; i<s.size(); i++){ for(int j=0; j<9; j++){ if(s[i]==num[j]){ ans+=s[i]-'0'; } } } cout << ans << endl; return 0; }