HDU 6045 - Is Derek lying | 2017 Multi-University Training Contest 2

/*
HDU 6045 - Is Derek lying [ 分析 ]
题意:
	有N个问题, 每个问题有A,B,C三种答案,答对加一分,答错不加分
	给出甲乙两人的答案,给出两人的分数先x, y,问分数是否正确
分析:
	统计甲乙相同的答案数目为 a, 不同的答案数目为 b
	若甲的分数为x,则y能取到的最小值为 max(0, x-b),即甲答对的题目尽量在b中
	y能取到的最大值为 b-max(0,x-a)+min(x,a) ,即甲答对的题目尽量在a中,答错的尽量在b中

编码时长:32分钟(-1)
*/
#include <bits/stdc++.h>
using namespace std;
const int N = 80005;
int t, n, x, y;
char s1[N], s2[N];
int main()
{
    scanf("%d", &t);
    while (t--)
    {
        scanf("%d%d%d", &n, &x, &y);
        scanf("%s%s", s1, s2);
        int a = 0, b = 0;
        for (int i = 0; i < n; i++)
        {
            if (s1[i] == s2[i]) a++;
            else b++;
        }
        int miny = max(0, x-b);
        int maxy = b - max(0, x-a) + min(x, a);
        if (miny <= y && y <= maxy) puts("Not lying");
        else puts("Lying");
    }
}

  

posted @ 2017-07-27 21:26  nicetomeetu  阅读(131)  评论(0编辑  收藏  举报