結果
問題 | No.289 数字を全て足そう |
ユーザー |
|
提出日時 | 2019-02-26 22:32:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 605 bytes |
コンパイル時間 | 558 ms |
コンパイル使用メモリ | 68,272 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 04:56:40 |
合計ジャッジ時間 | 1,409 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <iostream> #include <stdio.h> #include <cmath> #define FOR(i, a, b) for (int i = a; i < b; i++) #define FORN(i, a, b) for (int i = a; i <= b; i++) #define P(s) cout << s << endl #define PC(condition, _true, _false) if (condition) _true; else _false; using namespace std; // // Created by karayuu on 2019-02-26. // int main() { string s; cin >> s; int ans = 0; for (auto c : s) { if (isdigit(c) != 0) { //ASCIIコード上では0=48, 1=49となるのでcから0の48を引けばその値になる. ans += c - '0'; } } P(ans); }