結果
| 問題 | 
                            No.432 占い(Easy)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             mag
                         | 
                    
| 提出日時 | 2020-09-08 10:47:23 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 8 ms / 2,000 ms | 
| コード長 | 643 bytes | 
| コンパイル時間 | 1,688 ms | 
| コンパイル使用メモリ | 167,508 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-29 11:49:33 | 
| 合計ジャッジ時間 | 2,715 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n)for(int i=0;i<(n);i++)
#define rep3(n)for(;n>0;n--)
void out(){cout<<endl;} template<typename Head,typename... Tail> void out(Head&& head,Tail&&... tail){cout<<head<<" ";out(forward<Tail>(tail)...);}
int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int t;
  cin>>t;
  int hoge;
  string a,b;
  rep3(t){
    cin>>a;
    while(a.size()!=1){
      b="";
      rep(j,a.size()-1){
        hoge=a[j]-'0'+a[j+1]-'0';
        //out(a,b,j,hoge,hoge/10+hoge%10);
        b+=to_string(hoge/10+hoge%10);
      }
      a=b;
    }
    cout<<a<<endl;
  }
}
            
            
            
        
            
mag