結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
![]() |
提出日時 | 2015-11-03 12:29:23 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 417 bytes |
コンパイル時間 | 686 ms |
コンパイル使用メモリ | 67,828 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-07 20:29:52 |
合計ジャッジ時間 | 1,342 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include<iostream> #include<stdio.h> #include<map> using namespace std; int main(){ string str; cin>> str; map<char, int> mp; for(int i=0; i<str.size(); i++){ if(str[i] < 58){ mp[str[i]] += (int)str[i] - 48; } } int ans = 0; auto itr = mp.begin(); for(; itr!=mp.end(); itr++){ ans += itr->second; } cout<< ans<< endl; return 0; }