WHY???求助
查看原帖
WHY???求助
1235738
wangruhao楼主2024/4/5 22:22

a,b怎么为B?

#include<bits/stdc++.h>
using namespace std;
char before[10];
int main()
{
	long long w=1,l,beforemi,nowmi,mi;
	double end;
	char a,b;
    cin>>l>>before;
	a=before[0];
	if (before[3]=='?')
	{
		b=before[4];
	}
	else
	{
		b=before[3];
	}
	
	


	if (a='G')
	{
		beforemi=60;
	}
	if (a='M')
	{
		beforemi=50;
	}	
	if (a='K')
	{
		beforemi=30;
	}
	if (a='B')
	{
		beforemi=0;
	}

	if (b='G')
	{
		nowmi=60;
	}
	if (b='M')
	{
		nowmi=50;
	}
	if (b='M')
	{
		nowmi=30;
	}
	if (b='B')
	{
		nowmi=0;
	}
	mi=beforemi-nowmi;
	if (mi>=0)
	{
		for (int i = 1; i <= mi; i++)
		{
			w*=2;
		}
		end=w*l*1.0;
		cout<<fixed<<setprecision(6)<<end;
	}
	else
	{
		mi=mi*(-1);
		for (int i = 1; i <= mi; i++)
		{
			w*=2;
		}
		end=1.0/w*l;
		cout<<fixed<<setprecision(6)<<end;		
	}
	
    return 0;

}

吃柠檬

2024/4/5 22:22
加载中...