結果

問題 No.23 技の選択
ユーザー ciel
提出日時 2014-11-16 22:50:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 262 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 40,704 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-31 21:18:50
合計ジャッジ時間 1,344 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
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=0;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