結果

問題 No.432 占い(Easy)
ユーザー おんそくちゃん
提出日時 2017-02-11 04:44:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 66,092 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 11:58:14
合計ジャッジ時間 1,802 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#define S size()
using namespace std;

int main() {
	string Sn;
	int T;
	cin >> T;
	while (T--) {
		cin >> Sn;
		while(Sn.S != 1){
			string N;
			for (int i = 0; i < (int)Sn.S-1; i++) {
				int box = (Sn[i] - '0')+ (Sn[i + 1] - '0');
				if (box >= 10) box = box / 10 + box % 10;
				N += box + '0';

			}
			Sn = N;
		}
		cout << Sn << endl;
	}
	return EXIT_SUCCESS;
}
0