物理题(physics,HDU 5826)

来源:互联网 发布:淘宝商家热线电话 编辑:程序博客网 时间:2024/06/08 12:22

高中物理题:汽车以恒定功率启动。

https://www.zybang.com/question/3a5bdab5c8422ba094cba86fb5dcdcdc.html

用到一些积分技巧。


还有大白书P9的一道思维题——蚂蚁

http://blog.csdn.net/xl2015190026/article/details/52909647


代码

#include<stdio.h>#include<algorithm>#include<math.h>using namespace std;const int maxn = 100010;int n;double C;double V[maxn];int Q;double t;int k;void read(){    scanf("%d %lf",&n,&C);    for(int i=1;i<=n;i++)        scanf("%lf %*lf %*lf",V+i);    sort(V+1,V+1+n);}void solve(){    read();    scanf("%d",&Q);    while(Q--)    {        scanf("%lf %d",&t,&k);        printf("%.3lf\n",sqrt((V[k]*V[k]/2/C+t)*2*C));    }}int main(){    int T;    scanf("%d",&T);    while(T--) solve();    return 0;}


原创粉丝点击