結果

問題 No.1200 お菓子配り-3
ユーザー bachoppibachoppi
提出日時 2020-08-28 22:15:01
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,213 bytes
コンパイル時間 1,233 ms
コンパイル使用メモリ 124,560 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-09 08:51:43
合計ジャッジ時間 14,994 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,384 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 11 ms
4,380 KB
testcase_08 AC 12 ms
4,380 KB
testcase_09 AC 11 ms
4,384 KB
testcase_10 AC 11 ms
4,380 KB
testcase_11 AC 11 ms
4,380 KB
testcase_12 AC 93 ms
4,384 KB
testcase_13 AC 95 ms
4,380 KB
testcase_14 AC 94 ms
4,384 KB
testcase_15 AC 95 ms
4,380 KB
testcase_16 AC 94 ms
4,380 KB
testcase_17 AC 337 ms
4,380 KB
testcase_18 AC 485 ms
4,380 KB
testcase_19 AC 113 ms
4,384 KB
testcase_20 AC 931 ms
4,380 KB
testcase_21 AC 929 ms
4,384 KB
testcase_22 AC 1,098 ms
4,380 KB
testcase_23 AC 932 ms
4,384 KB
testcase_24 AC 922 ms
4,380 KB
testcase_25 AC 922 ms
4,380 KB
testcase_26 AC 923 ms
4,384 KB
testcase_27 AC 1 ms
4,384 KB
testcase_28 AC 1,196 ms
4,380 KB
testcase_29 AC 1,382 ms
4,384 KB
testcase_30 AC 1,381 ms
4,380 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

int main(){
  int S; cin >> S;
  while(S--){
    int x, y; cin >> x >> y; int ans = 0;
    if(x<y) swap(x, y);
    int p = x+y; int m = x-y;
    set<pair<int, int>> pl;
    for(int i=1; i*i<=p; i++){
      if(p%i==0){
        pl.insert({i, 0}); pl.insert({p/i, 0});
      }
    }
    for(int i=1; i*i<=m; i++){
      if(m%i==0){
        pl.insert({i, 1}); pl.insert({m/i, 1});
      }
    }
    for(auto k: pl){
      if(k.second==1){
        if(pl.count({k.first+2, 0})){
          if((p/(k.first+2))%2==(m/k.first)%2 && p/(k.first+2)>(m/k.first)){
            ans++; //cout << k.first << " " << p << " " << m << endl;
          }
        }
      }
    }
    cout << ans << endl;
  }
}
0