結果

問題 No.432 占い(Easy)
ユーザー koarikoari
提出日時 2020-04-06 12:27:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 830 bytes
コンパイル時間 1,882 ms
コンパイル使用メモリ 171,896 KB
実行使用メモリ 5,316 KB
最終ジャッジ日時 2023-09-20 07:43:57
合計ジャッジ時間 3,439 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
4,384 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int t;
  cin >> t;
  deque<ll> c;
  ll k;
  rep(i,t) {
    cin >> k ;
    string s = to_string(k);
    deque<ll> b;
    rep(i,s.size()){
      b.push_back(s[i]-'0');
    }
    while(b.size()>1){
    deque<ll> a;
    swap(a,b);
    repi(i,1,a.size()){
      a[i-1]+=a[i];
      a[i-1]=(a[i-1]/10)+(a[i-1]%10);
      while(a[i-1]>=10){
	a[i-1]=(a[i-1]/10)+(a[i-1]%10);
      }
	b.push_back(a[i-1]);
    }
  }
  c.push_back(b[0]);
  }
  rep(i,t){
  cout << c.front() << endl;
  c.pop_front();
  }
  
  return 0;
  }
0