0分求调
查看原帖
0分求调
1278417
F_Maple_leaves楼主2025/1/20 14:45

为什么样例过了过不了?

#include <iostream>
#include <string>
using namespace std;
int w[100];
int main()
{
	string a;
	int cnt=1;
	getline(cin,a);
	a.append(1,',');
	int longg=0;
	bool truee=1;
	char b[100];
	int dx=0,xx=0,zf=0,sz=0;
	for(int i=0; i<a.size(); i++)
	{
		char x=a[i];

		if(x!=',')
		{
			int x1=x;
			if(x1>=97&&x1<=122 || x1>=48&&x1<=57 || x1>=65&&x1<=90 || x1==33 || x1==64 || x1==35 || x1==36)
			{
				if(x1>=97&&x1<=122) xx+=1;
				else if(x1>=65&&x1<=90) dx+=1;
				else if(x1>=48&&x1<=57) sz+=1;
				else zf+=1;
				b[longg]=x;
				longg+=1;

			}
			else truee=0;
		}
		else
		{

			if(longg>=6&&longg<=12&&truee==1&&(dx!=0&&xx!=0 || dx!=0&&sz!=0 || xx!=0&&sz!=0 ||dx!=0&&xx!=0&&sz!=0)&&zf!=0)
			{

				for(int i=0; i<longg; i++)
				{
					cout<<b[i];
					b[i]=0;
				}
				b[100]= {0};
				cout<<endl;
				longg=0;
				xx=0;
				dx=0;
				zf=0;
				sz=0;
			}
			else
			{
				for(int i=0; i<=100; i++)
				{
					b[i]=0;
				}
			}


		}
	}

}
2025/1/20 14:45
加载中...