結果
| 問題 |
No.1200 お菓子配り-3
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-28 22:40:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 809 bytes |
| コンパイル時間 | 1,676 ms |
| コンパイル使用メモリ | 166,732 KB |
| 実行使用メモリ | 16,976 KB |
| 最終ジャッジ日時 | 2024-11-14 15:53:23 |
| 合計ジャッジ時間 | 173,268 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 2 |
| other | TLE * 31 |
コンパイルメッセージ
main.cpp: In function 'long long int yta()':
main.cpp:46:1: warning: no return statement in function returning non-void [-Wreturn-type]
46 | }
| ^
ソースコード
#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; }
void fast_input_init(){
ios::sync_with_stdio(false);
cin.tie(0);
}
int yta();
signed main(){
fast_input_init();
int s;
cin >> 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(){
cin >> 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);
}
}
cout << ans << endl;
}