結果

問題 No.1352 Three Coins
ユーザー DaYuanChi
提出日時 2021-01-17 16:44:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 588 bytes
コンパイル時間 2,682 ms
コンパイル使用メモリ 195,716 KB
最終ジャッジ日時 2025-01-18 01:41:27
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other AC * 10 WA * 10 RE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int cnt[4000000];

int main(){
  vector<int> d(3);
  cin >> d[0] >> d[1] >> d[2];
  sort(d.begin(), d.end());
  int a = d[0]; int b = d[1]; int c = d[3];
  int flag = 0;
  flag = gcd(a, gcd(b, c));
  if(flag>1){
    cout << "INF" << endl;
    return 0;
  }
  for(int i = 0; i < b; i++){
    for(int j = 0; j < a; j++){
      for(int k = 0; k <= a*b/c; k++){
        cnt[a*i+b*j+c*k]++;
      }
    }
  }
  int ans = 0;
  for(int i = 1; i < a*b; i++){
    if(cnt[i]==0) ans++;
  }
  cout << ans << endl;
  return 0;
}
  
0