結果
問題 | No.432 占い(Easy) |
ユーザー |
![]() |
提出日時 | 2019-08-19 22:24:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 529 bytes |
コンパイル時間 | 768 ms |
コンパイル使用メモリ | 75,040 KB |
実行使用メモリ | 7,552 KB |
最終ジャッジ日時 | 2024-10-05 07:15:33 |
合計ジャッジ時間 | 1,460 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int T; cin >> T; while (T--) { string s; cin >> s; int n = s.size(); vector<vector<int>> dp(n, vector<int>(n)); for (int i = 0; i < n; i++) dp[0][i] = s[i] - '0'; for (int i = 1; i < n; i++) for (int j = 0; j < n - i; j++) { int t = dp[i - 1][j] + dp[i - 1][j + 1]; dp[i][j] = t / 10 + t % 10; } cout << dp[n - 1][0] << endl; } return 0; }