比赛 |
20111012 |
评测结果 |
EAAAAWAWAW |
题目名称 |
抗击SARS |
最终得分 |
60 |
用户昵称 |
Yeehok |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2011-10-12 21:59:10 |
显示代码纯文本
#include<iostream>
#include<cstdio>
using namespace std;
double x,r,l,v,wu,bing,q[20][100];
int answer=0,qi,mo,dai=1,t=2,w[22];
int main()
{
freopen("sars.in","r",stdin);
freopen("sars.out","w",stdout);
cin>>x>>r>>l>>v;
wu=0;
bing=x;
if (wu>=bing-r-0.00001&&wu<=bing+r+0.00001)
{
answer++;
}
wu+=v;
if (wu>=bing-r-0.00001&&wu<=bing+r+0.00001)
{
answer++;
}
w[1]=2;
q[1][0]=bing-l;
q[1][1]=bing+l;
while (l>=1)
{
int temp=0,ge=0;
wu+=v;
for (int i=0;i<w[dai];)
{
if (wu-v<q[dai][i]-r-0.00001&&wu>q[dai][i]-r-0.00001)
temp++;
if (wu-v<q[dai][i]-r-0.00001&&wu>q[dai][i]+r+0.00001)
temp++;
if (wu-v>q[dai][i]-r-0.00001&&wu<q[dai][i]+r+0.00001)
temp++;
if (wu-v<q[dai][i]+r+0.00001&&wu>q[dai][i]+r+0.00001)
{
temp++;
}
i+=1;
}
if (temp)
answer++;
for (int i=0;i<w[dai];i++)
{
q[dai+1][i*2]=q[dai][i]-l/2;
q[dai+1][i*2+1]=q[dai][i]+l/2;
ge++;
}
w[dai+1]=ge*2;
dai++;
l=l/2;
}
printf("%d\n",answer);
return 0;
}