結果

問題 No.982 Add
ユーザー cureskolcureskol
提出日時 2020-02-11 16:09:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 392 bytes
コンパイル時間 1,723 ms
コンパイル使用メモリ 172,904 KB
実行使用メモリ 8,140 KB
最終ジャッジ日時 2024-04-08 15:32:19
合計ジャッジ時間 3,966 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
8,140 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 55 ms
8,140 KB
testcase_03 AC 64 ms
8,140 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 WA -
testcase_06 AC 55 ms
8,140 KB
testcase_07 AC 59 ms
8,140 KB
testcase_08 AC 57 ms
8,140 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 64 ms
8,140 KB
testcase_12 AC 52 ms
8,140 KB
testcase_13 AC 54 ms
8,140 KB
testcase_14 AC 40 ms
8,140 KB
testcase_15 AC 59 ms
8,140 KB
testcase_16 WA -
testcase_17 AC 55 ms
8,140 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 1 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 1 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 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;
  for(int i=0;i<1000;i++)for(int j=0;j<1000;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