結果
問題 | No.1200 お菓子配り-3 |
ユーザー |
![]() |
提出日時 | 2024-08-13 02:55:02 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 3,115 ms / 4,000 ms |
コード長 | 1,021 bytes |
コンパイル時間 | 489 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 77,160 KB |
最終ジャッジ日時 | 2024-08-13 02:55:26 |
合計ジャッジ時間 | 24,561 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
import sysinput = sys.stdin.readlineT=int(input())for tests in range(T):X,Y=map(int,input().split())if X==Y:xr=round(X**(1/2))LIST=[]for i in range(1,xr+1):if X%i==0:LIST.append(i)if X//i>i:LIST.append(X//i)ANS=X-1for l in LIST:A=l-1if A==1:continueelse:B=X//(A+1)if A>0 and B>0:ANS+=1print(ANS)continueif X<Y:X,Y=Y,Xxr=round((X-Y)**(1/2))LIST=[]for i in range(1,xr+1):if (X-Y)%i==0:LIST.append(i)if (X-Y)//i>i:LIST.append((X-Y)//i)ANS=0for l in LIST:A=l+1if A>0 and (X+Y)%(A+1)==0:k=(X-Y)//(A-1)l=(X+Y)//(A+1)if (k+l)%2==0 and k+l>0 and (l-k)%2==0 and l-k>0:ANS+=1print(ANS)