結果

問題 No.432 占い(Easy)
ユーザー kpinkcat
提出日時 2023-08-14 09:43:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 987 ms
コンパイル使用メモリ 104,784 KB
最終ジャッジ日時 2025-02-16 08:03:39
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#include <Windows.h>
#endif

int main()
{
    int n;
    string s, t;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> s;
        while (s.size() > 1){
            string temp;
            for (int j = 0; j < s.size() - 1; j++){
                int t;
                t = (s[j] - '0') + (s[j+1] - '0');
                temp += ((t >= 10) ? t%10 + 1 + '0' : t + '0');
            }
            s = temp;
        }
        cout << s << endl;
    }
}
0