結果
| 問題 |
No.289 数字を全て足そう
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-22 09:37:54 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 424 bytes |
| コンパイル時間 | 2,694 ms |
| コンパイル使用メモリ | 275,860 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-22 09:37:59 |
| 合計ジャッジ時間 | 4,076 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
[[nodiscard]] static inline constexpr uint_fast32_t solve(const std::string& S) noexcept
{
uint_fast32_t ans = 0;
for (uint_fast32_t i = 0; i != S.size(); ++i)
if (std::isdigit(S[i]))
ans += S[i] - '0';
return ans;
}
int main()
{
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
std::string S;
S.reserve(10'000);
std::cin >> S;
std::cout << solve(S) << '\n';
return 0;
}