洛谷P5706 再分肥宅水

 快乐water文~ヾ(≧ ▽ ≦)ゝ

题目描述

现在有 t 毫升肥宅快乐水,要均分给 n 名同学。每名同学需要 2 个杯子。现在想知道每名同学可以获得多少毫升饮料(严格精确到小数点后 3 位),以及一共需要多少个杯子。输入一个实数 t 和一个整数 n,使用空格隔开。输出两个数字表示答案,使用换行隔开。

1≤t≤10000且不超过3位小数,1≤n≤1000

这题灰常灰常简单,幼儿园数学。

Code

#include<bits/stdc++.h>
using namespace std;
double kls;//每人能分到多少快乐水
int bz;//杯子个数
int tx;//同学个数
int main() 
{
	cin>>kls>>tx;
	kls/=tx;
	bz=tx*2;
	cout<<fixed<<setprecision(3)<<kls<<endl<<bz;
	return 0;
}

猜你喜欢

转载自blog.csdn.net/apple_59169997/article/details/125435873