結果

問題 No.432 占い(Easy)
ユーザー oooooba
提出日時 2021-02-21 15:38:06
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 773 bytes
コンパイル時間 952 ms
コンパイル使用メモリ 111,252 KB
最終ジャッジ日時 2025-01-19 03:01:32
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int32_t t;
    cin >> t;
    for (auto i = 0; i < t; ++i) {
        string s;
        cin >> s;
        while (s.size() > 1) {
            string ss = "";
            for (auto j = 0; j < s.size() - 1; ++j) {
                auto x = (s[j] - '0') + (s[j + 1] - '0');
                if (x >= 10)
                    x = 1 + x % 10;
                ss += to_string(x);
            }
            s = ss;
        }
        cout << s << endl;
    }
    return 0;
}
0