結果

問題 No.1200 お菓子配り-3
ユーザー yurukumoyurukumo
提出日時 2021-08-01 22:49:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,795 bytes
コンパイル時間 3,560 ms
コンパイル使用メモリ 227,492 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-14 19:04:35
合計ジャッジ時間 29,736 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 3,107 ms
4,348 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define int long long
#define endl "\n"
#define all(n) n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
#define rep(i, s, n) for (int i = s; i < (int)(n); i++)
#define floatset(n) fixed<<setprecision(n)
#define rangeout(x,y,h,w) (x<0||y<0||h-1<x||w-1<y)
using namespace std;
using namespace atcoder;
template<class T>using vec=vector<T>;
template<class T>using min_queue=priority_queue<T,vector<T>,greater<T>>;
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;
struct Edge1{ll to,cost;};
using WGraph = vec<vec<Edge1>>;
struct BellEdge{ll from,to,cost;};
using BGraph=vec<BellEdge>;
constexpr ll INF = 1e18;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
template<typename T>
bool chmin(T&a,T b){return a>b?a=b,true:false;}
template<typename T>
bool chmax(T&a,T b){return a<b?a=b,true:false;}
bool Flag(int bit,int i){return (bit&(1LL<<i));}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
void solve(){
    int X,Y;
    cin>>X>>Y;
    if(X<Y)swap(X,Y);
    int sum=X+Y,sa=X-Y;
    auto f=[&](int a,int b)->bool{
        if(a<=1)return false;
        if(b<=1)return false;
        if(a-2==0){
            return(sa==0);
        }
        if(sa%(a-2)==0){
            return((sa/(a-2))%2==(b%2));
        }else return false;
    };
    int ans=0;
    for(int i=1;i*i<=sum;i++)if(sum%i==0){
        if(i==(sum/i)){
            if(f(i,sum/i))ans++;
        }else{
            if(f(i,sum/i))ans++;
            if(f(sum/i,i))ans++;
        }
    }
    cout<<ans<<endl;
}
signed main(){
    int S;
    cin>>S;
    while(S--)solve();
}
0