#include #define P 3.1415927#define toFeet(x) x/12.0#define toMiles(x) x/5280.0int main(){ double diameter;//直径 int revolutions;//转数 double time;//香蕉 double s; int count=1; while(scanf("%lf%d%lf",&diameter,&revolutions,&time),revolutions){ time/=3600; diameter/=63360; s=diameter*P*revolutions; printf("Trip #%d: %.2lf %.2lf\n",count++,s,s/time); }}
2条回答 默认 最新
- jezhu 2016-05-19 09:49关注
稍有改动
import java.util.Scanner; public class Main { public static void main(String[] args) { final double PI = 3.1415927; Scanner scan = new Scanner(System.in);//标准输入流 int a = scan.nextInt();//首先输入有多少组数据 double x[][] = new double[a][3];//用二维数组存放数据 直径 转数 时间 依次输入就可以 空格 回车都可以分隔 for (int i = 0; i < x.length; i++) { for (int j = 0; j < x[i].length; j++) { x[i][j]=scan.nextLong(); } } scan.close();//关闭标准输入流 int count = 1; for (int i = 0; i < x.length; i++) { x[i][2] /= 3600; x[i][0] /= 63360; double s = x[i][0]*PI*x[i][1]; System.out.println(String.format("Trip #%d: %.21f %.21f", count++,s,s/x[i][2])); } } public static double toFeet(double x){//进行换算的方法 传入x返回换算的值 调用方法toFeet(x); return x/12.0; } public static double toMiles(double x){ return x/5280.0; } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
- ¥15 如何在scanpy上做差异基因和通路富集?
- ¥20 关于#硬件工程#的问题,请各位专家解答!
- ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
- ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
- ¥30 截图中的mathematics程序转换成matlab
- ¥15 动力学代码报错,维度不匹配
- ¥15 Power query添加列问题
- ¥50 Kubernetes&Fission&Eleasticsearch
- ¥15 報錯:Person is not mapped,如何解決?