結果

問題 No.432 占い(Easy)
ユーザー incuiio
提出日時 2023-05-19 17:21:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 893 bytes
コンパイル時間 1,067 ms
コンパイル使用メモリ 127,656 KB
最終ジャッジ日時 2025-02-13 01:16:25
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>
#include <cassert>
#include <regex>
using std::cout;
using std::cin;
using std::string;
using std::vector;

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        string s;
        cin >> s;
        while (s.size() > 1)
        {
            string new_s = "";
            for (int i = 1; i < s.size(); i++)
            {
                int j = s[i] - '0' + s[i-1] - '0';
                if (j >= 10)
                {
                    j++;
                }
                j %= 10;
                new_s += '0' + j;
            }
            s = new_s;
        }
        cout << s << '\n';
    }
}
0