【 OJ 】 HDOJ1038 18年11月17日18:43 [ 35 ]

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/QingCoffe/article/details/84191458

ummmm 又是一个水题.....英语不太好,看了半天题目换来的又是一个泡泡

AC代码:

# include<iostream>
# include<iomanip>
using namespace std;
int main(void) {
	//车轮直径、转数和总旅行时间。
	double  r, vl, t; //直径英寸  时间秒
	double pi = 3.1415927;
	//英里的总距离(精确到2位小数)和英里每小时的速度(精确到2位小数)
	double d, v;
	int index=1;
	double c;//周长
	cin >> r >> vl >> t;
	while (vl) {
		c = r*pi;// 2πr
		d = c*vl;// 总距离
		//每英里有5280英尺 一英尺有12英寸
		d = (d / 12) / 5280;//换算成英里
		t = t / 3600;//换算成小时
		v = d / t;//距离/时间
		cout.setf(ios::fixed);
		cout << "Trip #" << index++ << ": " <<setprecision(2) << d << " " << setprecision(2)<<v << endl;
		cin >> r >> vl >> t;
	}
	system("pause");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/QingCoffe/article/details/84191458