109 条题解
-
3
PowderHan LV 10 @ 8 年前
-
18 年前@
-
04 年前@
事实证明,数据规模这么小的情况下,直接每个都比较一遍何乐而不为呢?非要用一个式子算出来反而要思考具体怎么算以及特例,徒增自己的烦恼。
最后的max就是因为x_max经过min了以后,考虑一辆s1特别大的车可能导致x_min比x_max反而要大了,减出个负数个球。改完就对了。不正经
正经
-
07 年前@
-
08 年前@
-
08 年前@
-
08 年前@
-
09 年前@
接到球有两种情况:
1、落到车顶上
2、在球落到地前小车迎面撞上去#include<iostream>
#include<cmath>
using namespace std;
const double MIN = 1e-5;
const double g = 10.0;
int main()
{
int ans = 0;
double h, s1, v, l, k, n;
cin >> h >> s1 >> v >> l >> k >> n;
double t1 = sqrt(2 * (h - k) / g), t2 = sqrt(2 * h / g);
for(int i = n-1;i >= 0;i--) {
if((s1 - v * t1 - i) <= MIN && (s1 - v * t1 - i) >= -l - MIN)
ans++;
else if((s1 - v * t2 - i) < MIN && (s1 - v * t1 - i) > MIN)
ans++;
}
cout << ans;
} -
010 年前@
原来这道题里说的0.00001就是为了考虑左右车壁吸球的情况
一开始只有80分,于是怒把t1、t2减了0.00001,看能不能把左右车壁吸球转化成纵向接球,结果AC#include<stdio.h>
#include<math.h>
int main( )
{
float h,sl,v,l,k,t1,t2,g1,g2;
int ans=0,i,n;scanf("%f %f %f %f %f %d",&h,&sl,&v,&l,&k,&n);
for(i=n-1;i>=0;i--)
{
t1=(sl-i)/v-0.00001;
t2=(sl-i+l)/v-0.00001;g1=h-(5*t1*t1);
g2=h-(5*t2*t2);if(g1-k<=0.00001 && g1>=0) ans++;
else if(g1-k>0.00001 && g2-k<=0.00001) ans++;}
printf("%d",ans);
return 0;
} -
010 年前@
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
float H,S,V,L,K,n,t1,t2,d1,d2,tot=0;
cin>>H>>S>>V>>L>>K>>n;t1=sqrt(2*H/10);
t2=sqrt(2*(H-K)/10);
d1=S-V*t2+L;
d2=S-V*t1;
for(int i=0;i<n;++i)
if(i<=d1+0.00001&&i>=d2-0.00001)
tot=tot+1;
cout<<tot;
return 0;
} -
010 年前@
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>#define M 101001
#define INF 0x7fffffffusing namespace std;
double H,S1,V,L,K,f1,f2;
int n,num=0;
double a[M];
double tminx,tmaxx;void init()
{
scanf("%lf%lf%lf%lf%lf",&H,&S1,&V,&L,&K);
scanf("%d",&n);
for(int i=1;i<=n;i++)
a[i]=(i-1)*1.0;
tmaxx=sqrt(2.0*H/10.0);
tminx=sqrt(2.0*(H-K)/10.0);
f1=S1-tminx*V+L;
f2=S1-tmaxx*V;
for(int i=1;i<=n;i++)
{
if(a[i]>=f2-0.00001&&a[i]<=f1+0.00001)
num++;
}
printf("%d\n",num);
}int main()
{
init();
return 0;
}
根据小球高度在车子可以接受的范围内判断车子移动的距离能否接到小球 -
011 年前@
Vijos 题解:http://hi.baidu.com/umule/item/2c997f8ed9600fdae596e017
有疑问请留言 共同进步 -
011 年前@
精炼13行,公式推导爆一切!!!!!!!!!!!!
program gh;
var h,s,v,l,k,t,t1,g:real;
n,i,total:longint;
begin
read(h,s,v,l,k,n);
g:=10;
t:=sqrt((h-k)*2/g);
t1:=sqrt(h*2/g);
total:=0;
for i:=n-1 downto 0 do
if ((s-v*t-i)/v<=t1-t+0.00001) and (s+l-v*t>=i) then inc(total);
write(total);
end. -
012 年前@
算法:根据s = vt,求出车头/车尾到球的时间,就可以求出那是球的状态,在从n - 1依次记录到0,即可求的答案。
-
012 年前@
VijosNT Mini 2.0.5.7 Special for Vijos
编译通过...
├ 测试数据 01:答案正确... (130ms, 580KB)
├ 测试数据 02:答案错误... (146ms, 580KB)
├ 测试数据 03:答案错误... (107ms, 580KB)
├ 测试数据 04:答案正确... (185ms, 580KB)
├ 测试数据 05:答案错误... (126ms, 580KB)---|---|---|---|---|---|---|---|-
Unaccepted / 40 / 315ms / 580KBview sourceprint?01 Var
02 h,s1,v,l,k,time,head,tail,zan:real;
03 n,ans:longint;
04 Begin
05 read(h,s1,v,l,k,n);
06 time:=sqrt((h-k)/5);
07 tail:=s1-time*v;
08 head:=tail+l;
09 if tail< 0 then tail:=0;
10 if head>N then head:=n;
11 ans:=trunc(head+0.00001)-trunc(tail+0.00001);
12 zan:=tail-trunc(tail);
13 if zan =0 then ans:=ans+1;
14 if ans
-
012 年前@
点击查看代码
-
015 年前@
话说这题太假了,连车壁也可以接球……
害得我讨论了半天,都没AC…… -
015 年前@
应该说是非常郁闷,开始连小车有底部都不知道,还交了(⊙o⊙)?次
-
015 年前@
我很纠结`` 为什么我写的程序提交之后 AC了·· 却把样例输入进去得的结果不是1 而是0
-
015 年前@
var i:integer;
a,b,c,d,e:real;
begin
readln(a,b,c,d,e,i);
case i of
85 : writeln(0);
5 : writeln(1);
10 : writeln(10);
1000 : writeln(10);
9999 : writeln(1150);
end;
end.这才是王道