結果

問題 No.1200 お菓子配り-3
ユーザー 👑 PCTprobabilityPCTprobability
提出日時 2020-07-19 21:20:14
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 799 bytes
コンパイル時間 3,078 ms
コンパイル使用メモリ 167,620 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-09 07:56:26
合計ジャッジ時間 18,909 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 13 ms
4,384 KB
testcase_08 AC 13 ms
4,376 KB
testcase_09 AC 12 ms
4,376 KB
testcase_10 AC 13 ms
4,380 KB
testcase_11 AC 11 ms
4,380 KB
testcase_12 AC 105 ms
4,380 KB
testcase_13 AC 108 ms
4,380 KB
testcase_14 AC 108 ms
4,380 KB
testcase_15 AC 110 ms
4,376 KB
testcase_16 AC 107 ms
4,380 KB
testcase_17 AC 385 ms
4,376 KB
testcase_18 AC 557 ms
4,380 KB
testcase_19 AC 129 ms
4,380 KB
testcase_20 AC 1,071 ms
4,380 KB
testcase_21 AC 1,066 ms
4,380 KB
testcase_22 AC 1,258 ms
4,380 KB
testcase_23 AC 1,073 ms
4,380 KB
testcase_24 AC 1,051 ms
4,380 KB
testcase_25 AC 1,063 ms
4,380 KB
testcase_26 AC 1,065 ms
4,380 KB
testcase_27 WA -
testcase_28 AC 849 ms
4,380 KB
testcase_29 AC 2,343 ms
4,380 KB
testcase_30 AC 2,353 ms
4,380 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int ss(long long x,long long y){
    long long n,m;
  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){
       if((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){
          if((m/z)%2==(n/(z+2))%2&&(m/z)<=(n/(z+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