結果

問題 No.1200 お菓子配り-3
ユーザー PCTprobabilityPCTprobability
提出日時 2020-08-29 16:32:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,017 bytes
コンパイル時間 2,236 ms
コンパイル使用メモリ 202,884 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 00:09:38
合計ジャッジ時間 18,211 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 3 ms
6,944 KB
testcase_04 AC 3 ms
6,940 KB
testcase_05 AC 4 ms
6,940 KB
testcase_06 AC 3 ms
6,944 KB
testcase_07 AC 13 ms
6,940 KB
testcase_08 AC 13 ms
6,944 KB
testcase_09 AC 13 ms
6,944 KB
testcase_10 AC 13 ms
6,944 KB
testcase_11 AC 12 ms
6,944 KB
testcase_12 AC 107 ms
6,940 KB
testcase_13 AC 108 ms
6,944 KB
testcase_14 AC 108 ms
6,944 KB
testcase_15 AC 111 ms
6,944 KB
testcase_16 AC 108 ms
6,944 KB
testcase_17 AC 388 ms
6,940 KB
testcase_18 AC 559 ms
6,940 KB
testcase_19 AC 128 ms
6,940 KB
testcase_20 AC 1,080 ms
6,940 KB
testcase_21 AC 1,066 ms
6,940 KB
testcase_22 AC 1,256 ms
6,940 KB
testcase_23 AC 1,072 ms
6,944 KB
testcase_24 AC 1,055 ms
6,940 KB
testcase_25 AC 1,085 ms
6,940 KB
testcase_26 AC 1,076 ms
6,944 KB
testcase_27 WA -
testcase_28 AC 847 ms
6,944 KB
testcase_29 AC 2,342 ms
6,940 KB
testcase_30 AC 2,365 ms
6,944 KB
testcase_31 AC 2 ms
6,944 KB
testcase_32 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int ss(long long x,long long y){
    long long n,m;
    if(x!=y){
  n=x+y;
  m=x-y;
  long long z=0;
  long long ans=0;
  for(int i=1;m>=i*i;i++){
    if(m%i==0){
       if(n%(i+2)==0&&(m/i)%2==(n/(i+2))%2&&(m/i)<=(n/(i+2))){
         ans++;
      }
      if(i!=m/i){
        z=m/i;
        if(n%(z+2)==0&&(m/z)%2==(n/(z+2))%2&&(m/z)<=(n/(z+2))){
            ans++;
        }
      }
    }
  }
  return ans;
    }
    else{
        n=2*x;
        long long ans=0;
       ans+=max(0ll,x-1);
       for(int i=2;i<=n;i++){
           if(i%2==0&&n%i==0){
               if(((n/i)-1)>=2){
                   ans++;
               }
           }
       }
       return ans;
    }
}
int main() {
 int s;
  cin>>s;
 
  vector<int> x(s);
  vector<int> y(s);
  for(int i=0;i<s;i++){
    cin>>x.at(i);
    cin>>y.at(i);
  }
  for(int i=0;i<s;i++){
    if(x.at(i)<y.at(i)){
      swap(x.at(i),y.at(i));
    }
   
  }
  for(int i=0;i<s;i++){
    cout<<ss(x.at(i),y.at(i))<<endl;
  }
}
0