結果

問題 No.1486 ロボット
ユーザー lllllll88938494
提出日時 2022-01-12 01:24:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 63,868 KB
最終ジャッジ日時 2024-11-14 12:36:46
合計ジャッジ時間 2,203 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b,c,d,e = map(int,input().split())
lim = (a+b)*(c+d)
x = a+b
y = c+d
cnt=0

if e <= lim:
    for i in range(1,e+1):
        if 1 <= i%x <= a and 1 <= i%y <= c:
            cnt+=1
    print(cnt)

else:
    for i in range(1,lim+1):
        if 1 <= i%x <= a and 1 <= i%y <= c:
            cnt+=1
    div,mod=divmod(e,lim)
    cnt = div*cnt
    
    for i in range(1,mod+1):
        if 1 <= i%x <= a and 1 <= i%y <= c:
            cnt+=1
    
    print(cnt)
0