错误满天飞(玄关)
查看原帖
错误满天飞(玄关)
1435692
difficultlong楼主2024/10/26 08:42
#include<bits/stdc++.h>
using namespace std;
int t,n;
int a[101];
char s[101];
int main(){
	scanf("%d%d",&t,&n);
	for(int i=1;i<=t;i++){
		scanf("%s",s+1);
		for(int j=1;j<=n;j++){
			a[s[j]]++;
		}
		bool flag=true;
		for(int j=1;j<=n;j++){
			if(j%2==1&&a[s[j]]<=1){
				flag=false;
		        break;
			}
			if(j%2==0&&a[s[j]]>1){
				flag=false;
				break;
			}
		}
		if(flag){
			printf("T\n");
		}
		else{
			printf("F\n");
		}
	}
	return 0;
}

我的思路是先计数,然后来判断,但是哪里错了呢(全输出F)

2024/10/26 08:42
加载中...