結果
| 問題 | 
                            No.432 占い(Easy)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-07-02 14:51:39 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 16 ms / 2,000 ms | 
| コード長 | 876 bytes | 
| コンパイル時間 | 708 ms | 
| コンパイル使用メモリ | 80,540 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-05 07:36:10 | 
| 合計ジャッジ時間 | 1,584 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
ソースコード
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#define mod 1000000007;
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pr;
int T;
vector<string> v;
 int main()
 {
	 cin >> T;
	 for (int i = 0; i < T; i++) {
		 string s,num,res="";
		 cin >> s;
		 if (s.size() == 1)v.push_back(s);
		 else {
			 while (res.size() != 1) {
				 res = "";
				 for (int j = 0; j < s.size() - 1; j++) {
					 string str = "";
					 str = to_string(s[j] - '0' + s[j + 1] - '0');
					 if (str.size() > 1) {
						 str = to_string(str[0] - '0' + str[1] - '0');
					 }
					 res += str;
				 }
				 s = res;
			 }
			 v.push_back(res);
		 }
	 }
	 for (int i = 0; i < T; i++) {
		 cout << v[i] << endl;
	 }
	return 0;
 }