题目链接

Problem Description

Derek and Alfia are good friends.Derek is Chinese,and Alfia is Austrian.This summer holiday,they both participate in the summer camp of Borussia Dortmund.During the summer camp,there will be fan tests at intervals.The test consists of N choice questions and each question is followed by three choices marked “A” “B” and “C”.Each question has only one correct answer and each question is worth 1 point.It means that if your answer for this question is right,you can get 1 point.The total score of a person is the sum of marks for all questions.When the test is over,the computer will tell Derek the total score of him and Alfia.Then Alfia will ask Derek the total score of her and he will tell her: “My total score is X,your total score is Y.”But Derek is naughty,sometimes he may lie to her. Here give you the answer that Derek and Alfia made,you should judge whether Derek is lying.If there exists a set of standard answer satisfy the total score that Derek said,you can consider he is not lying,otherwise he is lying.

Input

The first line consists of an integer T,represents the number of test cases.

For each test case,there will be three lines.

The first line consists of three integers N,X,Y,the meaning is mentioned above.

The second line consists of N characters,each character is “A” “B” or “C”,which represents the answer of Derek for each question.

The third line consists of N characters,the same form as the second line,which represents the answer of Alfia for each question.

Data Range:1≤N≤80000,0≤X,Y≤N,∑Ti=1N≤300000

Output

For each test case,the output will be only a line.

Please print “Lying” if you can make sure that Derek is lying,otherwise please print “Not lying”.

Sample Input

2

3 1 3

AAA

ABC

5 5 0

ABCBC

ACBCB

Sample Output

Not lying

Lying

题意:

有n道题,每道题做对得一分,做错不得分,有一个人说“第一个人得X分,第二个人得Y分”,有这两个人关于这n道题得答案,判断一下这句话能否正确。

思路:

这答案中会有num数目得答案两个人是完全相同得,至于这num道题究竟对几道我们不需要考虑,(x-y)得绝对值得到的是两个人做对的题目得差,这个值肯定要小于(n-num)这个值,还要满足条件就是说两个人除去共同作对的题目,其余作对的题目的和也是要小于等于(n-num)这个值。

#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
using namespace std;
const int N=80009;
int n,num,score1,score2;
char ch1[N];
char ch2[N];
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
num=0;
scanf("%d%d%d",&n,&score1,&score2);
scanf("%s",ch1);
scanf("%s",ch2);
int flag=0;
for(int i=0; i<n; i++)
{
if(ch1[i]==ch2[i])
num++;
}
int Min=min(score1,score2);
Min=min(num,Min);
if((abs(score1-score2)<=n-num)&&(score1+score2-2*Min<=n-num))
printf("Not lying\n");
else
printf("Lying\n"); }
return 0;
}

2017ACM暑期多校联合训练 - Team 2 1001 HDU 6045 Is Derek lying? (模拟)的更多相关文章

  1. 2017ACM暑期多校联合训练 - Team 8 1008 HDU 6140 Hybrid Crystals (模拟)

    题目链接 Problem Description Kyber crystals, also called the living crystal or simply the kyber, and kno ...

  2. 2017ACM暑期多校联合训练 - Team 6 1001 HDU 6096 String (字符串处理 字典树)

    题目链接 Problem Description Bob has a dictionary with N words in it. Now there is a list of words in wh ...

  3. 2017ACM暑期多校联合训练 - Team 5 1001 HDU 6085 Rikka with Candies (模拟)

    题目链接 Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, s ...

  4. 2017ACM暑期多校联合训练 - Team 1 1001 HDU 6033 Add More Zero (数学)

    题目链接 Problem Description There is a youngster known for amateur propositions concerning several math ...

  5. 2017ACM暑期多校联合训练 - Team 4 1004 HDU 6070 Dirt Ratio (线段树)

    题目链接 Problem Description In ACM/ICPC contest, the ''Dirt Ratio'' of a team is calculated in the foll ...

  6. 2017ACM暑期多校联合训练 - Team 9 1005 HDU 6165 FFF at Valentine (dfs)

    题目链接 Problem Description At Valentine's eve, Shylock and Lucar were enjoying their time as any other ...

  7. 2017ACM暑期多校联合训练 - Team 9 1010 HDU 6170 Two strings (dp)

    题目链接 Problem Description Giving two strings and you should judge if they are matched. The first stri ...

  8. 2017ACM暑期多校联合训练 - Team 8 1006 HDU 6138 Fleet of the Eternal Throne (字符串处理 AC自动机)

    题目链接 Problem Description The Eternal Fleet was built many centuries ago before the time of Valkorion ...

  9. 2017ACM暑期多校联合训练 - Team 8 1002 HDU 6134 Battlestation Operational (数论 莫比乌斯反演)

    题目链接 Problem Description The Death Star, known officially as the DS-1 Orbital Battle Station, also k ...

随机推荐

  1. 微信小程序组件 360

    data: { nums: 1, start: '', // change:'' // 上一部记忆数据 mid: '' }, mytouchmove: function (e) { var start ...

  2. vue-cli3使用cdn方式引入moment.js

    1. index.html引入: <script src="https://cdn.bootcss.com/moment.js/2.20.1/moment.min.js"&g ...

  3. 编写shell时,遇到let: not found错误及解决办法

    #!/bin/bashi=1sum=0while [ $i -le 100 ]do  let sum=sum+$i  let i++ done 在写一个简单的循环脚本时,报错 let: not fou ...

  4. Debugger DataSet 调试时查看DataSet

    delphi  跟踪调试的时候查看DataSet数据记录 Ctrl+F7调试 增强工具DataSethttp://edn.embarcadero.com/article/40268 http://do ...

  5. 第192天:js---Date对象属性和方法总结

    Date对象构造函数重载方法 一.第一种重载方法---基本 当前时间 //构造函数 - 第一种重载方法:基本 当前时间 console.log('构造函数 - 第一种重载方法:基本 当前时间') da ...

  6. 第111天:Ajax之jQuery实现方法

    由于jQuery中的Ajax方法是用了内置的deferred模块,是Promise模式的一种实现,而我们这里没有讲过,所以我们就不使用这一模式啦. 我们只定义一个Ajax方法,他可以简单的get,po ...

  7. ZOJ3113_John

    这个题目是一个典型的Anti_Sg.我也不知道为什么这么叫,呵呵,反正大家都这么叫,而且我也是听别人说,看别人的日志自己才知道的. 题目的意思是给你不同颜色的石子,每次可以去一种颜色的石子若干个(至少 ...

  8. SolrPerformanceFactors--官方文档

    原文地址:http://wiki.apache.org/solr/SolrPerformanceFactors Contents Schema Design Considerations indexe ...

  9. 【bzoj3518】点组计数 欧拉函数(欧拉反演)

    题目描述 平面上摆放着一个n*m的点阵(下图所示是一个3*4的点阵).Curimit想知道有多少三点组(a,b,c)满足以a,b,c三点共线.这里a,b,c是不同的3个点,其顺序无关紧要.(即(a,b ...

  10. Android四大组件之Intent(续)