标签:class blog code com size http string tar 404 line get
题目链接:Back to Intermediate Math
题意:两种过河方式,一种笔直过河,一种最快过河,求两种时间差
只要计算出两种时间,笔直过河的速度等于两个速度分量的合速度,最快就等于船速度,求出差即可。
代码:
#include <stdio.h> #include <string.h> #include <math.h> int t, d, v, u; int main() { int cas = 0; scanf("%d", &t); while (t--) { scanf("%d%d%d", &d, &v, &u); printf("Case %d: ", ++cas); if (u == 0 || v == 0 || v >= u) printf("can‘t determine\n"); else { double t1 = d * 1.0 / u; double t2 = d * 1.0 / sqrt(u * u - v * v); printf("%.3lf\n", fabs(t1 - t2)); } } return 0; }
UVA 10773 Back to Intermediate Math(数论),码迷,mamicode.com
UVA 10773 Back to Intermediate Math(数论)
标签:class blog code com size http string tar 404 line get
原文地址:http://blog.csdn.net/accelerator_/article/details/24579303