結果
問題 | No.1200 お菓子配り-3 |
ユーザー | chineristAC |
提出日時 | 2020-08-28 21:40:55 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,004 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 81,792 KB |
最終ジャッジ日時 | 2024-04-26 22:39:26 |
合計ジャッジ時間 | 35,467 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
52,088 KB |
testcase_01 | AC | 44 ms
57,728 KB |
testcase_02 | AC | 47 ms
57,984 KB |
testcase_03 | AC | 47 ms
57,984 KB |
testcase_04 | AC | 47 ms
58,240 KB |
testcase_05 | AC | 47 ms
58,100 KB |
testcase_06 | AC | 45 ms
57,984 KB |
testcase_07 | AC | 86 ms
60,928 KB |
testcase_08 | AC | 85 ms
60,672 KB |
testcase_09 | AC | 82 ms
60,800 KB |
testcase_10 | AC | 81 ms
60,528 KB |
testcase_11 | AC | 82 ms
60,288 KB |
testcase_12 | AC | 379 ms
70,400 KB |
testcase_13 | AC | 384 ms
70,400 KB |
testcase_14 | AC | 386 ms
70,512 KB |
testcase_15 | AC | 390 ms
70,784 KB |
testcase_16 | AC | 388 ms
70,480 KB |
testcase_17 | AC | 1,203 ms
76,544 KB |
testcase_18 | AC | 1,691 ms
76,800 KB |
testcase_19 | AC | 455 ms
71,672 KB |
testcase_20 | AC | 3,159 ms
76,172 KB |
testcase_21 | AC | 3,166 ms
76,416 KB |
testcase_22 | AC | 3,800 ms
76,672 KB |
testcase_23 | AC | 3,164 ms
76,160 KB |
testcase_24 | AC | 3,154 ms
76,544 KB |
testcase_25 | AC | 3,157 ms
76,324 KB |
testcase_26 | AC | 3,172 ms
76,672 KB |
testcase_27 | AC | 37 ms
52,352 KB |
testcase_28 | TLE | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
def divisors(M):#Mの約数列 O(n^(0.5+e)) import math d=[] i=1 while math.sqrt(M)>=i: if M%i==0: d.append(i) if i**2!=M: d.append(M//i) i=i+1 d.sort() return d import sys for _ in range(int(input())): x,y = map(int,input().split()) div = divisors(x+y) count = 0 for d in div: if x!=y: if d==1 or d==2: continue if (x+y)%d!=0 or (x-y)%(d-2)!=0: continue s = (x + y) // d t = (x - y) // (d-2) if (s + t) % 2 !=0: continue b = (s + t) // 2 c = (s - t) // 2 if b>0 and c>0: count += 1 else: if d==1: continue if d==2: s = (x + y) // d count += s - 1 else: if ((x+y) // d) %2 ==0: count += 1 print(count)