結果
| 問題 |
No.23 技の選択
|
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-07-29 19:01:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 811 bytes |
| コンパイル時間 | 480 ms |
| コンパイル使用メモリ | 72,720 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 16:47:32 |
| 合計ジャッジ時間 | 1,291 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:31:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
31 | scanf("%d%d%d",&h,&a,&d);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
typedef long long ll;
using namespace std;
#define mod 1000003
#define INF 1000000000
#define LLINF 2000000000000000000LL
#define SIZE 10000
int main(){
int h,a,d;
int dp[SIZE*2+1],ans=INF;
for(int i=0;i<=SIZE*2;i++) dp[i] = INF;
dp[0] = 0;
scanf("%d%d%d",&h,&a,&d);
for(int i=0;i<h;i++){
dp[i+a] = min(dp[i+a],dp[i]+2);
dp[i+d] = min(dp[i+d],dp[i]+3);
if(i+a>=h)
ans = min(ans,dp[i+a]);
if(i+d>=h)
ans = min(ans,dp[i+d]);
}
printf("%.2lf",ans/2.0);
return 0;
}
goodbaton