我的程式碼:
#include <stdio.h>
#include <string.h>
int main()
{
int n , k , j , t , qlen , alen , death , judge , book[123];
char q[200] , a[200];
while(1)
{
judge = 0;
for(k = 0 ; k < 123 ; k++)
{
book[k] = 0;
}
scanf("%d" , &n);
if(n == -1)
{
break;
}
scanf("%s%s" , &q , &a);
qlen = strlen(q);
alen = strlen(a);
death = 0;
for(k = 0 ; k < strlen(a) ; k++)
{
for(j = 0 , t = 0 ; j < strlen(q) ; j++)
{
if(a[k] == q[j])
{
t++;
q[j] = '0';
}
}
alen--;
qlen = qlen - t;
if(t == 0 && book[a[k]] == 0)
{
death++;
book[a[k]] = 1;
}
if(death == 7)
{
judge = 3;
break;
}
if(qlen == 0)
{
judge = 1;
break;
}
if(alen == 0 && qlen != 0 && death != 7)
{
judge = 2;
break;
}
}
printf("Round %d\n" , n);
if(judge == 1)
{
printf("You win.\n");
}
if(judge == 2)
{
printf("You chickened out.\n");
}
if(judge == 3)
{
printf("You lose.\n");
}
}
return 0;
}
第 1 測資點(0%): WA (line:78)
答案不正確
您的答案為: You lose. 正確答案為: You chickened out.
能幫忙的話真的很感謝~謝謝~~