要求:
https://leetcode-cn.com/problems/guess-numbers/
说明:
练手不解释
代码:
#include <stdio.h>
#include <string.h>
int main(){
int guess[100];
int answer[100];
int count = 0;
int i = 0;
while(scanf("%d",&guess[i]) != EOF){
i++;
if(getchar() == '\n'){
for(int j = 0;j <i;j++){
scanf("%d",&answer[j]);
if(answer[j] == guess[j]){
count++;
}
}
printf("%d\n",count);
memset(guess,0,sizeof(guess));
memset(answer,0,sizeof(answer));
count = 0;
i = 0;
}
}
}