結果

問題 No.982 Add
ユーザー cureskolcureskol
提出日時 2020-02-11 16:11:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 412 bytes
コンパイル時間 1,708 ms
コンパイル使用メモリ 173,088 KB
実行使用メモリ 135,180 KB
最終ジャッジ日時 2024-04-08 15:33:36
合計ジャッジ時間 14,830 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,253 ms
135,180 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 1,571 ms
135,180 KB
testcase_03 AC 1,774 ms
135,180 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 WA -
testcase_06 AC 1,803 ms
135,180 KB
testcase_07 AC 1,817 ms
135,180 KB
testcase_08 AC 1,638 ms
135,180 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1,819 ms
135,180 KB
testcase_12 AC 1,535 ms
135,180 KB
testcase_13 AC 1,654 ms
135,180 KB
testcase_14 AC 1,689 ms
135,180 KB
testcase_15 AC 1,700 ms
135,180 KB
testcase_16 WA -
testcase_17 AC 1,873 ms
135,180 KB
testcase_18 AC 2 ms
6,548 KB
testcase_19 AC 2 ms
6,548 KB
testcase_20 AC 2 ms
6,548 KB
testcase_21 AC 2 ms
6,548 KB
testcase_22 AC 3 ms
6,548 KB
testcase_23 AC 2 ms
6,548 KB
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}

signed main(){
  int a,b;cin>>a>>b;
  if(__gcd(a,b)>1)fin(-1);
  vector<int> v;
  if(a>b)swap(a,b);
  for(int i=0;i<5000;i++)for(int j=0;j<5000;j++)v.push_back(a*i+b*j);
  sort(v.begin(),v.end());
  unique(v.begin(),v.end());
  int ans=0;
  for(int i=0;i<1000;i++)ans+=v[i+1]-v[i]-1;
  fin(ans);
}
0