結果
| 問題 | No.1595 The Final Digit |
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2021-12-30 12:51:19 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 497 bytes |
| 記録 | |
| コンパイル時間 | 937 ms |
| コンパイル使用メモリ | 181,840 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-21 09:20:37 |
| 合計ジャッジ時間 | 1,824 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
long long p,q,r,i,next,mod;
long long K;
cin>>p>>q>>r>>K;
vector<long long> memo(1000,0);
i=(p%10)*100+(q%10)*10+(r%10);
memo[i]=1;
while(memo[i]!=K){
next=(i*10)%1000+(i/100+i/10+i)%10;
if(memo[next]){
mod=memo[i]+1-memo[next];
memo[next]+=mod*((K-memo[next])/mod);
}else{
memo[next]=memo[i]+1;
}
i=next;
}
cout<<(i/100)<<endl;
}
ytft