結果

問題 No.1200 お菓子配り-3
ユーザー kappybarkappybar
提出日時 2020-08-28 21:48:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 834 bytes
コンパイル時間 1,619 ms
コンパイル使用メモリ 165,512 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 22:43:34
合計ジャッジ時間 26,924 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 4 ms
5,376 KB
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,128 ms
5,376 KB
testcase_29 AC 2,291 ms
5,376 KB
testcase_30 AC 2,286 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        ll x,y;
        scanf("%lld%lld",&x,&y);
        ll z = x + y;
        vector<ll> v;
        for(ll i=1;i*i<=z;i++){
            if(z%i==0){
                v.push_back(i);
                if(i!=z/i) v.push_back(z/i);
            }
        }
        ll ans = 0;
        for(ll p:v){
            if(p==1) continue;
            ll b = x/(p-1),c = x%(p-1);
            if(y==(p-1)*c+b) ++ans;
        }
        printf("%lld\n",ans);
    }
    return 0;
}
0