結果

問題 No.1274 楽しい格子点
ユーザー hotman78hotman78
提出日時 2020-09-24 23:03:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,203 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 96,396 KB
最終ジャッジ日時 2023-09-30 00:39:01
合計ジャッジ時間 31,691 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 312 ms
93,016 KB
testcase_01 AC 457 ms
94,644 KB
testcase_02 AC 795 ms
96,392 KB
testcase_03 AC 240 ms
91,876 KB
testcase_04 AC 795 ms
96,396 KB
testcase_05 AC 1,203 ms
95,556 KB
testcase_06 AC 798 ms
95,948 KB
testcase_07 AC 593 ms
94,692 KB
testcase_08 AC 216 ms
89,592 KB
testcase_09 AC 1,177 ms
95,596 KB
testcase_10 AC 1,186 ms
95,912 KB
testcase_11 AC 795 ms
96,140 KB
testcase_12 AC 1,199 ms
95,556 KB
testcase_13 AC 1,182 ms
95,684 KB
testcase_14 AC 799 ms
95,904 KB
testcase_15 AC 601 ms
95,060 KB
testcase_16 AC 1,203 ms
95,780 KB
testcase_17 AC 1,183 ms
95,784 KB
testcase_18 AC 1,186 ms
95,636 KB
testcase_19 AC 1,198 ms
95,552 KB
testcase_20 AC 1,183 ms
95,452 KB
testcase_21 AC 593 ms
94,816 KB
testcase_22 AC 214 ms
89,648 KB
testcase_23 AC 216 ms
89,476 KB
testcase_24 AC 223 ms
89,596 KB
testcase_25 AC 217 ms
89,836 KB
testcase_26 AC 218 ms
89,600 KB
testcase_27 AC 217 ms
89,656 KB
testcase_28 AC 221 ms
89,492 KB
testcase_29 AC 218 ms
89,672 KB
testcase_30 AC 216 ms
89,320 KB
testcase_31 AC 225 ms
91,488 KB
testcase_32 AC 217 ms
89,472 KB
testcase_33 AC 216 ms
89,700 KB
testcase_34 AC 217 ms
89,704 KB
testcase_35 AC 217 ms
89,708 KB
testcase_36 AC 217 ms
89,536 KB
testcase_37 AC 216 ms
89,608 KB
testcase_38 AC 217 ms
89,644 KB
testcase_39 AC 217 ms
89,600 KB
testcase_40 AC 217 ms
89,604 KB
testcase_41 AC 213 ms
89,564 KB
testcase_42 AC 244 ms
91,652 KB
testcase_43 AC 245 ms
91,736 KB
testcase_44 AC 238 ms
91,836 KB
testcase_45 AC 247 ms
91,856 KB
testcase_46 AC 250 ms
91,592 KB
testcase_47 AC 225 ms
91,756 KB
testcase_48 AC 237 ms
91,908 KB
testcase_49 AC 595 ms
94,800 KB
testcase_50 AC 248 ms
91,892 KB
testcase_51 AC 248 ms
93,020 KB
testcase_52 AC 214 ms
88,868 KB
testcase_53 AC 359 ms
94,400 KB
testcase_54 AC 261 ms
92,276 KB
testcase_55 AC 1,196 ms
95,368 KB
testcase_56 AC 788 ms
96,324 KB
testcase_57 AC 218 ms
89,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import Decimal
import decimal
import sys
import math
a,b=map(int,input().split())
a=abs(a)
b=abs(b)
decimal.getcontext().prec = 400
if a==0 and b==0:
    print("0.25")
    sys.exit()
k=math.gcd(a,b)
ans=Decimal(0)
for i in range(1,100):
    for j in range(1,100):
        if i%k==1 and j%k==1:
            if (i//k+j//k)%2==0 or (a//k+b//k)%2==1:
                ans+=Decimal(1)/Decimal((i+j)**(i+j))
        if k==1:
            if (i//k+j//k)%2==0 or (a//k+b//k)%2==1:
                ans+=Decimal(1)/Decimal((i+j)**(i+j))
print(ans)
0