记录编号 |
38128 |
评测结果 |
AAAAAAAAAA |
题目名称 |
抗击SARS |
最终得分 |
100 |
用户昵称 |
TBK |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.003 s |
提交时间 |
2012-04-13 14:54:47 |
内存使用 |
34.59 MiB |
显示代码纯文本
#include <cstdio>
using namespace std;
long double bac[3000000];
#define MAX(X,Y) ((X)>(Y)?(X):(Y))
#define MIN(X,Y) ((X)>(Y)?(Y):(X))
int main ()
{
freopen("sars.in", "r", stdin);
freopen("sars.out", "w", stdout);
long double x, r, l, v;
scanf("%Lf%Lf%Lf%Lf", &x, &r, &l, &v);
long double ll = l*2, rr = r + 0.00001, xx = 0;
int head = 0, tail=1, ans=0;
bac[0] = x;
while (1)
{
for (int i=head; i<tail; i++)
if (MAX(bac[i] - rr, xx) <=
MIN(bac[i] + rr, xx+v))
{
ans++;
break;
}
xx += v;
if ((ll = ll/2) < 1)
break;
int ohead = head;
head = tail;
for (int i=ohead; i<head; i++)
{
bac[tail++] = bac[i] - ll;
bac[tail++] = bac[i] + ll;
}
}
printf("%d\n", ans);
return 0;
}