結果

問題 No.1936 Rational Approximation
ユーザー KudeKude
提出日時 2022-05-14 09:50:42
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 134 bytes
コンパイル時間 911 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 71,484 KB
最終ジャッジ日時 2023-09-29 23:45:53
合計ジャッジ時間 2,359 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,172 KB
testcase_01 AC 73 ms
71,104 KB
testcase_02 AC 73 ms
71,100 KB
testcase_03 AC 73 ms
71,472 KB
testcase_04 AC 72 ms
71,200 KB
testcase_05 AC 72 ms
71,340 KB
testcase_06 AC 71 ms
71,396 KB
testcase_07 AC 73 ms
71,212 KB
testcase_08 AC 70 ms
71,104 KB
testcase_09 AC 72 ms
71,404 KB
testcase_10 AC 72 ms
71,336 KB
testcase_11 AC 73 ms
71,484 KB
testcase_12 AC 72 ms
71,376 KB
testcase_13 AC 73 ms
71,332 KB
testcase_14 AC 72 ms
71,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p, q = map(int, input().split())
yl = pow(p, -1, q)
xl = p * yl // q
yr = pow(-p, -1, q)
xr = p * yr // q + 1
print(xl + yl + xr + yr)
0