两个人的分数分别是x和y,总分是n,给定每个人的答案,求是否有说谎。
1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 using namespace std; 5 const int MAX = 80010; 6 char str1[MAX], str2[MAX]; 7 int main() { 8 int t; 9 scanf("%d",&t); 10 while(t--) { 11 int n, x, y; 12 scanf("%d%d%d",&n,&x,&y); 13 scanf("%s%s",str1,str2); 14 int k = 0; 15 for(int i = 0; i < n; i ++) { 16 if(str1[i] == str2[i]) k++; 17 } 18 if(abs(x-y) > n-k || x+y > n+k) printf("Lying "); 19 else printf("Not lying "); 20 memset(str1,0,sizeof(str1)); 21 memset(str2,0,sizeof(str2)); 22 } 23 return 0; 24 }