結果

問題 No.1274 楽しい格子点
ユーザー tanon710tanon710
提出日時 2020-10-31 01:11:54
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 662 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 71,740 KB
最終ジャッジ日時 2023-09-30 00:47:18
合計ジャッジ時間 6,380 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 73 ms
71,476 KB
testcase_02 AC 74 ms
71,432 KB
testcase_03 AC 70 ms
71,432 KB
testcase_04 AC 72 ms
71,604 KB
testcase_05 AC 71 ms
71,384 KB
testcase_06 AC 69 ms
71,352 KB
testcase_07 AC 70 ms
71,376 KB
testcase_08 AC 68 ms
71,448 KB
testcase_09 AC 72 ms
71,536 KB
testcase_10 AC 70 ms
71,276 KB
testcase_11 AC 70 ms
71,380 KB
testcase_12 AC 72 ms
71,420 KB
testcase_13 AC 70 ms
71,356 KB
testcase_14 AC 70 ms
71,364 KB
testcase_15 AC 69 ms
71,444 KB
testcase_16 AC 70 ms
71,376 KB
testcase_17 AC 71 ms
71,432 KB
testcase_18 AC 71 ms
71,332 KB
testcase_19 AC 69 ms
71,392 KB
testcase_20 AC 71 ms
71,380 KB
testcase_21 AC 69 ms
71,440 KB
testcase_22 AC 70 ms
71,480 KB
testcase_23 AC 69 ms
71,180 KB
testcase_24 AC 70 ms
71,356 KB
testcase_25 AC 70 ms
71,280 KB
testcase_26 AC 70 ms
71,536 KB
testcase_27 AC 69 ms
71,680 KB
testcase_28 AC 69 ms
71,740 KB
testcase_29 AC 70 ms
71,356 KB
testcase_30 AC 68 ms
71,396 KB
testcase_31 AC 70 ms
71,360 KB
testcase_32 AC 70 ms
71,372 KB
testcase_33 AC 71 ms
71,472 KB
testcase_34 AC 69 ms
71,540 KB
testcase_35 AC 71 ms
71,380 KB
testcase_36 AC 69 ms
71,540 KB
testcase_37 AC 68 ms
71,320 KB
testcase_38 AC 69 ms
71,596 KB
testcase_39 AC 70 ms
71,416 KB
testcase_40 AC 70 ms
71,220 KB
testcase_41 AC 69 ms
71,684 KB
testcase_42 AC 70 ms
71,456 KB
testcase_43 AC 70 ms
71,220 KB
testcase_44 AC 70 ms
71,276 KB
testcase_45 AC 70 ms
71,424 KB
testcase_46 AC 69 ms
71,684 KB
testcase_47 AC 70 ms
71,384 KB
testcase_48 AC 69 ms
71,284 KB
testcase_49 AC 70 ms
71,372 KB
testcase_50 AC 70 ms
71,360 KB
testcase_51 AC 69 ms
71,360 KB
testcase_52 AC 74 ms
71,352 KB
testcase_53 AC 72 ms
71,468 KB
testcase_54 AC 72 ms
71,180 KB
testcase_55 AC 72 ms
71,536 KB
testcase_56 AC 72 ms
71,400 KB
testcase_57 AC 69 ms
71,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

a,b=map(int,input().split())
a=abs(a)
b=abs(b)
if a==0 and b==0:
    print(0.25)
elif a==0 or b==0:
    k=max(a,b)
    ans=0
    for x in range(1,20+1,k):
        for y in range(1,20+1,k):
            ans+=1/((x+y)**(x+y))
    print(ans)
else:
    g=gcd(a,b)
    a//=g
    b//=g
    ans=0.25
    for x in range(1,20+1,g):
        for y in range(1,20+1,g):
            if x==1 and y==1:
                continue
            if (a+b)%2==0:
                if (x+y)%2==0:
                    ans+=1/((x+y)**(x+y))
            else:
                ans+=1/((x+y)**(x+y))
    print(ans)
0