結果
| 問題 | No.23 技の選択 |
| コンテスト | |
| ユーザー |
YoshiRyu
|
| 提出日時 | 2017-03-31 13:36:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,000 bytes |
| 記録 | |
| コンパイル時間 | 1,069 ms |
| コンパイル使用メモリ | 159,448 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-07 04:39:57 |
| 合計ジャッジ時間 | 2,050 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 16 |
コンパイルメッセージ
main.cpp: In function ‘void Slove()’:
main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | #define SF(f,v) scanf(f,v)
| ~~~~~^~~~~
main.cpp:8:17: note: in expansion of macro ‘SF’
8 | #define SF_N(v) SF("%d",&v)
| ^~
main.cpp:24:9: note: in expansion of macro ‘SF_N’
24 | SF_N(H); SF_N(A); SF_N(D);
| ^~~~
main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | #define SF(f,v) scanf(f,v)
| ~~~~~^~~~~
main.cpp:8:17: note: in expansion of macro ‘SF’
8 | #define SF_N(v) SF("%d",&v)
| ^~
main.cpp:24:18: note: in expansion of macro ‘SF_N’
24 | SF_N(H); SF_N(A); SF_N(D);
| ^~~~
main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | #define SF(f,v) scanf(f,v)
| ~~~~~^~~~~
main.cpp:8:17: note: in expansion of macro ‘SF’
8 | #define SF_N(v) SF("%d",&v)
| ^~
main.cpp:24:27: note: in expansion of macro ‘SF_N’
24 | SF_N(H); SF_N(A); SF_N(D);
| ^~~~
ソースコード
#include "bits/stdc++.h"
// マクロ群
#define REP(i,n) for(int i=0;i<n;++i)
#define REP2(i,a,b) for (int i=(a);i<(b);++i)
#define rep(n) REP(i,n)
#define SF(f,v) scanf(f,v)
#define SF_N(v) SF("%d",&v)
#define SF_S(v) SF("%s",v)
#define PF(f,v) printf(f,v)
#define PFS_N(v) PF("%d ",v)
#define PFS_S(v) PF("%s ",v)
#define PFL_N(v) PF("%d\n",v)
#define PFL_S(v) PF("%s\n",v)
using namespace std;
const int INF = 1e9;
int H, A, D;
void Slove()
{
SF_N(H); SF_N(A); SF_N(D);
double dp[10010];
dp[H] = 0;
/// 全部必殺技で攻撃した回数を出す
for (int i = H; i > 0; i -= D) dp[H] += 1.5;
double ans = dp[H];
/// 通常攻撃の回数を1回ずつ増やしていき、残りは必殺技で攻撃する
int h = H;
int cnt = 0;
while (++cnt < dp[H] && (h -= A) >= 0)
{
dp[h] = cnt;
for (int j = h; j > 0; j -= D) dp[h] += 1.5;
ans = min(ans, dp[h]); // 最小値を得る
}
// 回答出力
PF("%f\n", ans );
}
int main() { Slove(); return 0; }
YoshiRyu