PTA C语言(原创题)
#include <stdio.h>
int main()
{
int n,i,s=0;
scanf("%d",&n);
char c[n];
scanf("%s",&c);
int a=0,b=0,count=0;
for(i=0;i<n;i++){
switch(c[i]){
case 'C':a++;
break;
case 'J':b++;
break;
case '9':count++;
break;}
}
if(a!=0&&b!=0){
s=1;
printf("JC HAPPY!!!\n");
}
else
printf("JC YYDS!!!\n");
if(count>0&&s==1){
for(int j=1;j<count;j++){
printf("JC HAPPY!!!\n");
}
}
return 0;
}
测试运行是对的,但是PTA判定部分正确;
希望帮我找找错;