56分求调
查看原帖
56分求调
1037554
hetao5422877楼主2024/10/3 17:07

各位dalao,帮本蒟蒻看下那里错乐,给下代码:

#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() 
{
	int T;
	cin >> T;
	if (T == 1) 
	{
		cout << "I love Luogu!" << endl;
	} 
	else if (T == 2) 
	{
		cout << 2 + 4 << " " << 10 - 2 - 4 << endl;
	} 
	else if (T == 3) 
	{
		cout << 14 / 4 << endl;  
		cout << 14 / 4 * 4 << endl; 
		cout << 14 % 4 << endl; 
	} 
	else if (T == 4) 
	{
		cout << fixed << setprecision(6) << 500.0 / 3 << endl;
	} 
	else if (T == 5) 
	{
		cout << (260 + 220) / (12 + 20) << endl;
	} 
	
	else if (T == 6)
	{
		cout << fixed << setprecision(6) << sqrt(6*6 + 9*9) << endl;
	} 
	else if (T == 7) 
	{
		cout << 100 + 10 << endl;  
		cout << 100 + 10 - 20 << endl;  
		cout << 0 << endl; 
	} 
	else if (T == 8) 
	{
		const double pi = 3.141593;
		int r = 5;
		cout << fixed << setprecision(6) << 2 * pi * r << endl;  
		cout << fixed << setprecision(6) << pi * r * r << endl; 
		cout << fixed << setprecision(6) << (4.0 / 3) * pi * r * r * r << endl; 
	} 
	else if (T == 9) 
	{
		int peaches = 1;
		for (int i = 0; i < 3; i++) 
		{
			peaches = (peaches + 1) * 2;
		}
		cout << peaches << endl;
	} 
	else if (T == 10) 
	{
		cout << 10 << endl;
	} 
	else if (T == 11) 
	{
		cout << 100 / (8 - 5) << endl;
	} 
	else if (T == 12) 
	{
		cout << 'M' - 'A' + 1 << endl; 
		cout << char('A' + 18 - 1) << endl; 
	} 
	else if (T == 13) 
	{
		const double pi = 3.141593;
		int r1 = 4, r2 = 10;
		double volume = (4.0 / 3) * pi * (r1 * r1 * r1 + r2 * r2 * r2);
		cout << int(pow(volume, 1.0 / 3)) << endl;  
	} 
	else if (T == 14) 
	{
		int price = (3500 - 110 * 10) / 9 + 110;
		cout << price << endl;
	}
	return 0;
}

2024/10/3 17:07
加载中...