結果
問題 | No.1486 ロボット |
ユーザー |
![]() |
提出日時 | 2022-05-09 20:02:44 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 1,850 ms |
コンパイル使用メモリ | 206,356 KB |
実行使用メモリ | 14,224 KB |
最終ジャッジ日時 | 2024-06-22 15:10:44 |
合計ジャッジ時間 | 3,010 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/numeric.d(2999): Warning: cannot inline function `std.numeric.gcdImpl!ulong.gcdImpl`
ソースコード
import std;void main() {long A, B, C, D, E;readf("%d %d %d %d %d\n", A, B, C, D, E);long s = A + B, t = C + D;long l = s * t / gcd(s, t);auto R1 = new bool[](l), R2 = new bool[](l);foreach (i; 0 .. l) {R1[i] = (i % s < A);R2[i] = (i % t < C);}auto both = new long[](l);foreach (i; 0 .. l) {if (i > 0) both[i] += both[i-1];if (R1[i] && R2[i]) ++both[i];}auto d = E / l, r = E % l;long res = both.back * d;if (r > 0) res += both[r-1];res.writeln;}