結果
| 問題 |
No.432 占い(Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-09 10:33:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 603 bytes |
| コンパイル時間 | 1,244 ms |
| コンパイル使用メモリ | 72,036 KB |
| 最終ジャッジ日時 | 2025-01-09 15:19:50 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
void solve() {
std::string s;
std::cin >> s;
int n = s.length();
std::vector<int> xs(n);
for (int i = 0; i < n; ++i) xs[i] = s[i] - '0';
while (n > 1) {
for (int i = 0; i + 1 < n; ++i) {
xs[i] += xs[i + 1];
while (xs[i] >= 10) xs[i] -= 9;
}
xs.pop_back();
--n;
}
std::cout << xs.front() << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int q;
std::cin >> q;
while (q--) solve();
return 0;
}