結果
| 問題 |
No.432 占い(Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 14:32:34 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 616 bytes |
| コンパイル時間 | 4,184 ms |
| コンパイル使用メモリ | 251,516 KB |
| 最終ジャッジ日時 | 2025-02-20 17:17:34 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
int t;
string s;
int main() {
cin >> t;
for (int i = 0; i < t; i++) {
cin >> s;
int k = s.size();
while (k > 1) {
string t;
for (int j = 0; j < k - 1; j++) {
int x = s[j] - '0' + s[j + 1] - '0';
if (x >= 10) {
string y = to_string(x);
x = y[0] - '0' + y[1] - '0';
}
t += '0' + x;
}
//cout << t << endl;
s = t;
k = s.size();
}
cout << s << endl;
}
return 0;
}