結果

問題 No.1200 お菓子配り-3
ユーザー Y17Y17
提出日時 2020-08-28 22:44:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 754 bytes
コンパイル時間 1,546 ms
コンパイル使用メモリ 163,136 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 00:00:54
合計ジャッジ時間 26,872 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 4 ms
6,944 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 4 ms
6,940 KB
testcase_05 AC 4 ms
6,944 KB
testcase_06 AC 4 ms
6,940 KB
testcase_07 AC 21 ms
6,940 KB
testcase_08 AC 22 ms
6,940 KB
testcase_09 AC 20 ms
6,940 KB
testcase_10 AC 21 ms
6,940 KB
testcase_11 AC 22 ms
6,944 KB
testcase_12 AC 186 ms
6,944 KB
testcase_13 AC 189 ms
6,940 KB
testcase_14 AC 188 ms
6,940 KB
testcase_15 AC 189 ms
6,940 KB
testcase_16 AC 186 ms
6,940 KB
testcase_17 AC 680 ms
6,940 KB
testcase_18 AC 975 ms
6,940 KB
testcase_19 AC 223 ms
6,940 KB
testcase_20 AC 1,885 ms
6,944 KB
testcase_21 AC 1,890 ms
6,944 KB
testcase_22 AC 2,237 ms
6,944 KB
testcase_23 AC 1,879 ms
6,944 KB
testcase_24 AC 1,885 ms
6,940 KB
testcase_25 AC 1,883 ms
6,944 KB
testcase_26 AC 1,883 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 3,138 ms
6,944 KB
testcase_29 AC 2,292 ms
6,940 KB
testcase_30 AC 2,280 ms
6,944 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int yta();

signed main(){
	int s;
	scanf("%lld", &s);
	while(s--) yta();

	return 0;
}

int x, y;
inline int valid(int a){
	if(a == 0) return 0;
	int sita = a*a-1;
	int ue = a*x-y;
	if(sita == 0 || ue <= 0 || ue%sita != 0) return 0;
	int b = ue/sita; 
	if(x-a*b <= 0) return 0;
	return 1;
}

int yta(){
	scanf("%lld %lld", &x, &y);

	int ans = 0;
	for(int i = 1;i*i <= x+y;i++){
		if((x+y)%i == 0){
			ans += valid(i-1);
			if(i*i < x+y) ans += valid((x+y)/i-1);
		}
	}
	printf("%lld\n", ans);
	return 0;
}
0