結果

問題 No.1200 お菓子配り-3
ユーザー titiatitia
提出日時 2020-08-28 22:03:54
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 672 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 76,288 KB
最終ジャッジ日時 2024-04-26 22:59:25
合計ジャッジ時間 45,032 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,096 KB
testcase_01 AC 46 ms
58,112 KB
testcase_02 AC 52 ms
59,136 KB
testcase_03 AC 53 ms
58,880 KB
testcase_04 AC 53 ms
58,752 KB
testcase_05 AC 55 ms
59,520 KB
testcase_06 AC 53 ms
58,880 KB
testcase_07 AC 93 ms
59,904 KB
testcase_08 AC 97 ms
61,184 KB
testcase_09 AC 90 ms
60,160 KB
testcase_10 AC 89 ms
59,776 KB
testcase_11 AC 88 ms
60,672 KB
testcase_12 AC 451 ms
67,072 KB
testcase_13 AC 460 ms
67,328 KB
testcase_14 AC 458 ms
67,712 KB
testcase_15 AC 467 ms
67,712 KB
testcase_16 AC 457 ms
67,072 KB
testcase_17 AC 1,489 ms
70,528 KB
testcase_18 AC 2,093 ms
73,088 KB
testcase_19 AC 537 ms
68,096 KB
testcase_20 AC 3,975 ms
76,160 KB
testcase_21 AC 3,965 ms
75,136 KB
testcase_22 TLE -
testcase_23 AC 3,975 ms
75,392 KB
testcase_24 AC 3,906 ms
74,752 KB
testcase_25 AC 3,934 ms
74,624 KB
testcase_26 AC 3,929 ms
76,032 KB
testcase_27 AC 42 ms
51,968 KB
testcase_28 AC 3,117 ms
71,296 KB
testcase_29 TLE -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from math import gcd
from math import sqrt

T=int(input())
for tests in range(T):
    ANS=0
    
    X,Y=map(int,input().split())
    if X<Y:
        X,Y=Y,X
    T=abs(X-Y)
    xr=int(sqrt(T))+1

    for i in range(1,xr+1):
        if T%i==0 and (X+Y)%(i+2)==0:
            if (T//i)%2==((X+Y)//(i+2))%2 and abs((T//i))<((X+Y)//(i+2)):
                ANS+=1
                #print(i+1)
        k=T//i
        if k<=xr:
            continue
        if T%k==0 and (X+Y)%(k+2)==0:
            if (T//k)%2==((X+Y)//(k+2))%2 and abs((T//k))<((X+Y)//(k+2)):
                ANS+=1
                #print(k+1)
    print(ANS)
    
    
    
0