結果

問題 No.23 技の選択
ユーザー cielciel
提出日時 2014-11-16 22:52:18
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 262 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 40,832 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 16:45:27
合計ジャッジ時間 1,516 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
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",&h,&a,&d);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <vector>
#include <algorithm>
#include <cstdio>
int main(){
	int h,a,d;
	scanf("%d%d%d",&h,&a,&d);
	std::vector<int>r(h+1);
	for(int i=1;i<=h;i++){
		r[i]=std::min((i>=a?r[i-a]:0)+2,(i>=d?r[i-d]:0)+3);
	}
	printf("%d.%d\n",r[h]/2,r[h]%2*5);
}
0