結果

問題 No.1200 お菓子配り-3
ユーザー ytqm3ytqm3
提出日時 2021-05-23 16:39:53
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,457 bytes
コンパイル時間 1,865 ms
コンパイル使用メモリ 198,388 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 02:25:22
合計ジャッジ時間 7,952 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 5 ms
6,940 KB
testcase_08 AC 6 ms
6,940 KB
testcase_09 AC 5 ms
6,940 KB
testcase_10 AC 5 ms
6,940 KB
testcase_11 AC 4 ms
6,940 KB
testcase_12 AC 38 ms
6,944 KB
testcase_13 AC 39 ms
6,940 KB
testcase_14 AC 38 ms
6,940 KB
testcase_15 AC 39 ms
6,940 KB
testcase_16 AC 36 ms
6,940 KB
testcase_17 AC 130 ms
6,940 KB
testcase_18 AC 185 ms
6,940 KB
testcase_19 AC 44 ms
6,944 KB
testcase_20 AC 364 ms
6,944 KB
testcase_21 AC 371 ms
6,944 KB
testcase_22 AC 439 ms
6,944 KB
testcase_23 AC 357 ms
6,940 KB
testcase_24 AC 353 ms
6,940 KB
testcase_25 AC 357 ms
6,940 KB
testcase_26 AC 357 ms
6,944 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 294 ms
6,944 KB
testcase_29 AC 785 ms
6,944 KB
testcase_30 AC 767 ms
6,940 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
typedef int64_t i64;
typedef long double f128;
using namespace std;

template<typename T>
void scan(T& n)
{
  cin>>n;
  return;
}

void scan()
{
  return;
}

template<typename T,class... Args>
void scan(T& n,Args&... args)
{
  scan(n);
  scan(args...);
  return;
}

template<typename T>
void scan_array(T start,T end)
{
  T now=start;
  for(;now!=end;++now)
  {
    scan(*now);
  }
  return;
}

template<typename T>
void print(T n)
{
  cout<<n;
  return;
}

template<typename T>
void println(T n)
{
  print(n);
  print('\n');
  return;
}

template<typename T,class... Args>
void println(T n,Args... args)
{
  print(n);
  print(' ');
  println(args...);
  return;
}

template<typename T>
void print_array(T start,T end)
{
  T now=start;
  print(*now);
  ++now;
  for(;now!=end;++now)
  {
    print(' ');
    print(*now);
  }
  print('\n');
  return;
}

vector<int> div_enum(int n)
{
  vector<int> res;
  for(int i=1;i*i<=n;++i)
  {
    if(n%i==0)
    {
      res.push_back(i);
      if(i*i!=n)
      {
        res.push_back(n/i);
      }
    }
  }
  return res;
}

void solve()
{
  int X,Y;
  scan(X,Y);
  if(X>Y)
  {
    swap(X,Y);
  }
  vector<int> vec=div_enum(Y-X);
  int ans=0;
  for(size_t i=0;i<vec.size();++i)
  {
    int A=vec[i]+1,n=(Y-X)/vec[i];
    if((X-n)%(A+1)==0&&X>n)
    {
      ans+=1;
    }
  }
  println(ans);
  return;
}

int main()
{
  int S;
  scan(S);
  for(int i=0;i<S;++i)
  {
    solve();
  }
  return 0;
}
0