結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 chro_96chro_96
提出日時 2023-07-21 23:09:48
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 1,334 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 30,720 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-15 21:04:42
合計ジャッジ時間 3,074 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 13 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 95 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 27 ms
5,376 KB
testcase_25 AC 29 ms
5,376 KB
testcase_26 AC 27 ms
5,376 KB
testcase_27 AC 29 ms
5,376 KB
testcase_28 AC 25 ms
5,376 KB
testcase_29 AC 67 ms
5,376 KB
testcase_30 AC 59 ms
5,376 KB
testcase_31 AC 67 ms
5,376 KB
testcase_32 AC 67 ms
5,376 KB
testcase_33 AC 64 ms
5,376 KB
testcase_34 AC 124 ms
5,376 KB
testcase_35 AC 116 ms
5,376 KB
testcase_36 AC 113 ms
5,376 KB
testcase_37 AC 119 ms
5,376 KB
testcase_38 AC 114 ms
5,376 KB
testcase_39 AC 35 ms
5,376 KB
testcase_40 AC 26 ms
5,376 KB
testcase_41 AC 31 ms
5,376 KB
testcase_42 AC 25 ms
5,376 KB
testcase_43 AC 32 ms
5,376 KB
testcase_44 AC 26 ms
5,376 KB
testcase_45 AC 21 ms
5,376 KB
testcase_46 AC 12 ms
5,376 KB
testcase_47 AC 16 ms
5,376 KB
testcase_48 AC 33 ms
5,376 KB
testcase_49 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  long long n = 0LL;
  int a1 = 0;
  long long b1 = 0LL;
  int a2 = 0;
  long long b2 = 0LL;
  int a3 = 0;
  long long b3 = 0LL;
    
  int res = 0;
  
  long long ans = 0LL;
  
  res = scanf("%lld", &n);
  res = scanf("%d", &a1);
  res = scanf("%lld", &b1);
  res = scanf("%d", &a2);
  res = scanf("%lld", &b2);
  res = scanf("%d", &a3);
  res = scanf("%lld", &b3);
  
  for (int i = 0; i < a3; i++) {
    for (int j = 0; j < a3; j++) {
      if ((long long)(i*a1+j*a2) <= n) {
        long long tmp = b1*((long long)i)+b2*((long long)j)+b3*((n-((long long)(i*a1+j*a2)))/((long long)a3));
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }
  
  for (int i = 0; i < a2; i++) {
    for (int j = 0; j < a2; j++) {
      if ((long long)(i*a1+j*a3) <= n) {
        long long tmp = b1*((long long)i)+b3*((long long)j)+b2*((n-((long long)(i*a1+j*a3)))/((long long)a2));
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }
  
  for (int i = 0; i < a1; i++) {
    for (int j = 0; j < a1; j++) {
      if ((long long)(i*a2+j*a3) <= n) {
        long long tmp = b2*((long long)i)+b3*((long long)j)+b1*((n-((long long)(i*a2+j*a3)))/((long long)a1));
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }
  
  printf("%lld\n", ans);
  return 0;
}
0