結果

問題 No.1486 ロボット
コンテスト
ユーザー lllllll88938494
提出日時 2022-01-12 01:24:46
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 455 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 205 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 62,848 KB
最終ジャッジ日時 2026-05-10 00:20:00
合計ジャッジ時間 2,043 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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