明明应该循环62次,为啥只循环了11次?求助
查看原帖
明明应该循环62次,为啥只循环了11次?求助
304722
HarryPotterJames楼主2021/8/2 14:34
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b,ans;
	a=b=ans="";
	int tl=0,sum=0,i;
	for(i=0;i<62;i++)
	{
		int j;
		cin>>ans;
		for(j=0;j<ans.size()&&ans[j+1]!=',';j++)
			a[j]=ans[j];
		j+=2; 
		for(;ans[j+1];j++)
			b[j]=ans[j];
		if(a=="Sweep the floor"||a=="Clean the table") tl+=20;
		else if(a=="Clean the windows") tl+=15;
		else if(a=="Cook the meal") tl+=25;
		else if(a=="Wash the car") tl+=35;
		else if(a=="Get the mail") tl+=10;
		if(b=="Sweep the floor"||b=="Clean the table") tl+=20;
		else if(b=="Clean the windows") tl+=15;
		else if(b=="Cook the meal") tl+=25;
		else if(b=="Wash the car") tl+=35;
		else if(b=="Get the mail") tl+=10;
		if(tl>60) sum++;
	}
	cout<<sum<<endl;
	return 0;
}

求各位大佬看看,谢谢

(请不要问题目是啥或从哪来的)

2021/8/2 14:34
加载中...