結果

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>



using namespace std;




int main() {
	int n;
	cin >> n;
	vector<string>p(n);
	
	for (int i = 0; i < n; i++) {
		string x;
		cin >> x;
		while (x.size() >= 2) {
			string h;
			
			for (int j = 0; j < x.size()-1; j++) {
				int y = x[j] - '0' + x[j + 1] - '0';
				if (y > 9)y++, y %= 10;
				h += ('0' + y);
				//cout << h << endl;
				
			}
			x = h;
		}
		p[i] = x;
	}
	for (int i = 0; i < n; i++)
		cout << p[i] << endl;

	return 0;


}


0