比赛 |
NOIP2017普及组模拟赛Mike |
评测结果 |
AAAAAAAAAA |
题目名称 |
嘉豪 |
最终得分 |
100 |
用户昵称 |
Pine |
运行时间 |
0.815 s |
代码语言 |
C++ |
内存使用 |
2.48 MiB |
提交时间 |
2017-09-29 20:57:35 |
显示代码纯文本
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#define LL long long
#define Max(x, y) (x >= y ? x : y)
#define Min(x, y) (x <= y ? x : y)
#define MM(x, y) memset(x, y, sizeof(x))
#define F(i, x, y) for(register int i=x; i<=y; i++)
#define R(i, x, y) for(register int i=x; i>=y; i--)
using namespace std;
inline void in(int &x)
{
static int ch; static bool flag;
for(flag=false, ch=getchar(); ch<'0'||ch>'9'; ch=getchar()) flag |= ch=='-';
for(x=0; isdigit(ch); ch=getchar()) x = (x<<1) + (x<<3) + ch - '0';
x = flag ? -x : x;
}
int v, n, a[1000005];
inline int work()
{
freopen("jiahao1.in","r",stdin); freopen("jiahao1.out","w",stdout);
in(v); in(n); F(i, 1, n) in(a[i]);
sort(a + 1, a + n + 1);
int now = 1, ans = 0; double w = v * 1.0;
while(w > a[now] && now <= n) {
w += (1.0*a[now]*0.5);
now ++; ans ++;
}
printf("%d\n", ans);
return 0;
}
int TAT = work();
int main() {;}