結果
| 問題 | No.1486 ロボット | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-04-23 22:19:07 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 241 ms / 2,000 ms | 
| コード長 | 766 bytes | 
| コンパイル時間 | 211 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-07-04 08:13:58 | 
| 合計ジャッジ時間 | 2,163 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
import sys
sys.setrecursionlimit(10 ** 6)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LC(): return list(input())
def IC(): return [int(c) for c in input()]
def MI(): return map(int, sys.stdin.readline().split())
INF = float('inf')
MOD = 10**9 + 7
def solve():
    A,B,C,D,E = MI()
    import math
    def my_lcm(x, y):
        return (x * y) // math.gcd(x, y)
    Loop = my_lcm(A+B,C+D)
    Same = 0
    for l in range(Loop):
        if(l%(A+B) <= A-1 and l%(C+D) <= C-1):
            Same+=1
    Ans = Same*(E//Loop)
    E = E - (E//Loop) * Loop#残り部分
    #print(Ans,E)
    for l in range(E):
        if(l%(A+B) <= A-1 and l%(C+D) <= C-1):
            Ans+=1
    print(Ans)
    return
solve()
            
            
            
        