結果

問題 No.176 2種類の切手
ユーザー kyuna
提出日時 2018-11-03 01:26:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 254 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 23,168 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-20 18:07:37
合計ジャッジ時間 1,632 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d %d %d", &a, &b, &t);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>

int main() {
	int a, b, t;
    int ans = 2e9;
	scanf("%d %d %d", &a, &b, &t);
	for (int i = 0; i <= t / b && i < a; i++) {
		int tmp = b * i + (t - b * i + a - 1) / a * a;
		if (ans > tmp) ans = tmp;
	}
	printf("%d", ans);
	return 0;
}
0