結果

問題 No.432 占い(Easy)
ユーザー ebicochineal
提出日時 2016-10-21 09:27:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 449 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 55,976 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-23 15:59:32
合計ジャッジ時間 1,341 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

char solva(string s) {
    int a, n = s.size();
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j < n - i; ++j) {
            a = s[j] + s[j + 1]  - 96;
            s[j] = a > 9 ? a % 10 + 49 : a + 48;
        }
    }
    return s[0];
}

int main() {
    int n;
    string s;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> s;
        cout << solva(s) << endl;
    }
    return 0;
}
0