結果
| 問題 | No.23 技の選択 | 
| コンテスト | |
| ユーザー |  YoshiRyu | 
| 提出日時 | 2017-03-31 15:14:26 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 964 bytes | 
| コンパイル時間 | 1,513 ms | 
| コンパイル使用メモリ | 157,896 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-28 17:20:24 | 
| 合計ジャッジ時間 | 2,288 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 33 | 
コンパイルメッセージ
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:26:9: note: in expansion of macro ‘SF_N’
   26 |         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:26:18: note: in expansion of macro ‘SF_N’
   26 |         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:26:27: note: in expansion of macro ‘SF_N’
   26 |         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;
double ans;
double memo[20010];
 
void Slove()
{
	SF_N(H); SF_N(A); SF_N(D);
 
	int aid = 10000;	// インデクス補助値
	ans = INF;
 
	// 通常攻撃の回数を(0から)1回ずつ増やしていき、残りは必殺技で攻撃する
	int cnt = 0;
	do
	{
		memo[H + aid] = cnt;
 
		for (int h = H; h > 0; h -= D) memo[H + aid] += 1.5;
 
		ans = min(ans, memo[H + aid]);	// 最小値を得る
 
	} while (cnt++ < ans && (H -= A) > -A);
 
	// 回答出力
	PF("%lf\n", ans );
}
 
int main() { Slove(); return 0; }
            
            
            
        