求求看看吧!!!!!!橙题,啊我做一晚上了我特想知道自己咋错的
查看原帖
求求看看吧!!!!!!橙题,啊我做一晚上了我特想知道自己咋错的
784985
groundzero楼主2022/9/2 20:56
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
//32
using namespace std;
bool flag,flag2;
int ans,sum,tot,tot2;
char ch[100008],ch1[100004]; 
int main()
{
	scanf("%s",ch);
	for(int i=0;i<strlen(ch);i++)
	{
		if('A'<ch[i]&&ch[i]<'Z')
		ch[i]+=32;
	}
	while(scanf("%s",ch1)!=EOF)
	{
		flag=0;
		
		if(strlen(ch1)!=strlen(ch))
		continue;
		for(int i=0;i<strlen(ch1);i++)
		{
			if('A'<ch1[i]&&ch1[i]<'Z')
			ch1[i]+=32;
			if(ch[i]!=ch1[i])
			{
				flag=1;
				break;
			}
		}
		if(flag==0)
		{
			if(sum==0)
			tot=tot2;
			sum++;
		}
		tot2+=strlen(ch1);
	}
	if(sum!=0)
	cout<<sum<<" "<<tot;
	else cout<<"-1";
}
2022/9/2 20:56
加载中...