結果

問題 No.982 Add
ユーザー DaYuanChi
提出日時 2021-01-28 20:37:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 418 bytes
コンパイル時間 2,113 ms
コンパイル使用メモリ 192,028 KB
最終ジャッジ日時 2025-01-18 08:35:31
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 RE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int cnt[10005];

int main(){
  int a, b; cin >> a >> b;
  if(gcd(a,b)>1){
    cout << -1 << endl;
    return 0;
  }
  int m = a*b-a-b;
  for(int i = 0; i <= 100; i++){
    for(int j = 0; j <= 100; j++){
      cnt[a*i+b*j]++;
    }
  }
  int ans = 0;
  for(int i = 1; i <= m; i++){
    if(cnt[i]==0) ans++;
  }
  cout << ans << endl;
  return 0;
}
  
0