結果
問題 | No.1486 ロボット |
ユーザー | mkawa2 |
提出日時 | 2021-04-23 21:29:59 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 358 ms / 2,000 ms |
コード長 | 859 bytes |
コンパイル時間 | 76 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 18,604 KB |
最終ジャッジ日時 | 2024-07-04 07:39:21 |
合計ジャッジ時間 | 2,484 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.buffer.readline()) def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.buffer.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def BI(): return sys.stdin.buffer.readline().rstrip() def SI(): return sys.stdin.buffer.readline().rstrip().decode() inf = 10 ** 16 md = 10 ** 9 + 7 # md = 998244353 from math import gcd def lcm(a, b): return a * b // gcd(a, b) a, b, c, d, e = LI() l = lcm(a + b, c + d) cnt = [0] * l for i in range(l): if i % (a + b) < a and i % (c + d) < c: cnt[i] = 1 p, r = divmod(e, l) ans = sum(cnt) * p + sum(cnt[:r]) print(ans)