結果

問題 No.1352 Three Coins
ユーザー DaYuanChiDaYuanChi
提出日時 2021-01-17 16:44:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 588 bytes
コンパイル時間 2,356 ms
コンパイル使用メモリ 203,664 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-19 23:03:49
合計ジャッジ時間 5,768 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 RE -
testcase_09 WA -
testcase_10 RE -
testcase_11 WA -
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 RE -
testcase_15 WA -
testcase_16 AC 1 ms
4,380 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 RE -
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 RE -
testcase_25 AC 2 ms
4,384 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 RE -
testcase_31 WA -
testcase_32 RE -
testcase_33 AC 2 ms
4,380 KB
testcase_34 RE -
testcase_35 RE -
権限があれば一括ダウンロードができます

ソースコード

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