传送门:【codeforces】Codeforces Round #278 (Div. 1)
487A. Fight the Monster
枚举买的攻击力数以及防御力数,然后二分推出胜利需要的生命数,然后求一下需要的价格,在所有情况中取最小值。需要注意的是,攻击力可达到大约200,血量尽量设大一点。
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std ;
typedef long long LL ;
#define rep( i , a , b ) for ( int i = ( a ) ; i < ( b ) ; ++ i )
#define For( i , a , b ) for ( int i = ( a ) ; i <= ( b ) ; ......
阅读全文