結果
| 問題 |
No.1595 The Final Digit
|
| コンテスト | |
| ユーザー |
Ain48803949
|
| 提出日時 | 2021-07-09 22:18:33 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 2,000 ms |
| コード長 | 934 bytes |
| コンパイル時間 | 146 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-07-01 16:55:41 |
| 合計ジャッジ時間 | 1,983 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
import bisect,collections,copy,heapq,itertools,math,string,sys,queue,time,random
input = lambda: sys.stdin.readline().rstrip()
def I(): return input()
def IS(): return input().split()
def II(): return int(input())
def IIS(): return map(int,input().split())
def LIIS(): return list(map(int,input().split()))
def Base_n_to_10(X,n):
out = 0
for i in range(1,len(str(X))+1):
out += int(X[-i])*(n**(i-1))
return out#int out
def Base_10_to_n(X, n):
if (X//n):
return Base_10_to_n(X//n, n)+str(X%n)
return str(X%n)
INF=10**18
MOD=10**9+7
sys.setrecursionlimit(10**8)
##############################################################################
p,q,r,k=IIS()
li=[0 for i in range(10**5)]
li[0]=p%10
li[1]=q%10
li[2]=r%10
i=3
while True:
li[i]=(li[i-1]+li[i-2]+li[i-3])%10
if li[i]==r%10 and li[i-1]==q%10 and li[i-2]==p%10:
#i-2こ
break
i+=1
li=li[:i-2]
print(li[k%(i-2)-1])
Ain48803949