結果

問題 No.1200 お菓子配り-3
ユーザー titiatitia
提出日時 2020-08-28 22:06:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 727 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 73,344 KB
最終ジャッジ日時 2024-04-26 23:08:59
合計ジャッジ時間 44,944 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,224 KB
testcase_01 AC 44 ms
58,240 KB
testcase_02 AC 51 ms
58,880 KB
testcase_03 AC 52 ms
58,624 KB
testcase_04 AC 50 ms
58,752 KB
testcase_05 AC 54 ms
59,776 KB
testcase_06 AC 51 ms
59,008 KB
testcase_07 AC 94 ms
59,648 KB
testcase_08 AC 97 ms
61,312 KB
testcase_09 AC 90 ms
59,648 KB
testcase_10 AC 89 ms
59,904 KB
testcase_11 AC 88 ms
60,544 KB
testcase_12 AC 451 ms
66,688 KB
testcase_13 AC 458 ms
66,688 KB
testcase_14 AC 459 ms
66,688 KB
testcase_15 AC 467 ms
66,560 KB
testcase_16 AC 447 ms
66,176 KB
testcase_17 AC 1,472 ms
69,632 KB
testcase_18 AC 2,081 ms
71,296 KB
testcase_19 AC 530 ms
66,816 KB
testcase_20 AC 3,917 ms
73,344 KB
testcase_21 AC 3,932 ms
72,064 KB
testcase_22 TLE -
testcase_23 AC 3,953 ms
72,192 KB
testcase_24 AC 3,875 ms
71,936 KB
testcase_25 AC 3,924 ms
72,320 KB
testcase_26 AC 3,930 ms
73,216 KB
testcase_27 AC 40 ms
51,968 KB
testcase_28 AC 3,105 ms
67,968 KB
testcase_29 TLE -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
import sys
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=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)
    sys.stdout.write(str(ANS)+"\n")
    
    
    
0