結果
| 問題 | No.1200 お菓子配り-3 |
| コンテスト | |
| ユーザー |
たたき@競プロ
|
| 提出日時 | 2023-09-14 09:22:32 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 839 bytes |
| コンパイル時間 | 5,028 ms |
| コンパイル使用メモリ | 308,244 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 16:43:56 |
| 合計ジャッジ時間 | 13,420 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 WA * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
int t;cin>>t;
rep(tt,t){
int x,y;cin>>x>>y;
int z=x+y;
int ans=0;
if(x==y)ans=x;
for(int i=3;i*i<=z;i++)if(z%i==0){
int j=z/i;
if(j<3)continue;
int a=i-1;
int b=(x-j)/(a-1);
int c=j-b;
if(b>0&&c>0&&x==b*a+c&&y==a*c+b)ans++;
a=j-1;
b=(x-i)/(a-1);
c=i-b;
if(b>0&&c>0&&x==b*a+c&&y==a*c+b)ans++;
}
cout<<ans<<"\n";
}
}
たたき@競プロ