結果

問題 No.176 2種類の切手
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-10-04 22:30:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 543 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 61,596 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-05-01 12:33:04
合計ジャッジ時間 3,262 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,756 KB
testcase_01 AC 2 ms
6,820 KB
testcase_02 AC 2 ms
6,816 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 WA -
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 1 ms
6,944 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=]
   28 |         printf("%d\n", ans);
      |                 ~^     ~~~
      |                  |     |
      |                  int   ll {aka long long int}
      |                 %lld

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
const ll INF = 1e12;

int main(void){
	ll a, b, t; cin >> a >> b >> t;
	ll ans = INF;
	for (int i = 0; i <= 1e9; ++i){//bの数
		if(b * i <= t){
			int nokori = t - b * i;
			int j;
			if(nokori % a == 0){
				j = nokori / a;
			}else{
				j = nokori / a + 1;
			}
			ans = min(ans, (ll)(b * i + a * j));
		}else{
			break;
		}
	}
	printf("%d\n", ans);
	return 0;
}
0