2017ACM暑期多校联合训练 - Team 2 1001 HDU 6045 Is Derek lying? (模拟)
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? (模拟)的更多相关文章
- 2017ACM暑期多校联合训练 - Team 8 1008 HDU 6140 Hybrid Crystals (模拟)
题目链接 Problem Description Kyber crystals, also called the living crystal or simply the kyber, and kno ...
- 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 ...
- 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 ...
- 2017ACM暑期多校联合训练 - Team 1 1001 HDU 6033 Add More Zero (数学)
题目链接 Problem Description There is a youngster known for amateur propositions concerning several math ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 2017ACM暑期多校联合训练 - Team 8 1002 HDU 6134 Battlestation Operational (数论 莫比乌斯反演)
题目链接 Problem Description The Death Star, known officially as the DS-1 Orbital Battle Station, also k ...
随机推荐
- 更改HTTP头信息
http信息分三部分 1.请求行 GET lizi.php HTTP/1.1 2.HTTP头信 Host: localhost Connection: keep-alive Cache-Contr ...
- Spring Boot 学习笔记 - 01
看了[纯洁的微笑]的博客后,我决定开始学好 Spring 体系了,真的是解决了饥渴的我.
- Linux下修改环境变量PATH
1.什么是环境变量(PATH) 在Linux中,在执行命令时,系统会按照PATH的设置,去每个PATH定义的路径下搜索执行文件,先搜索到的文件先执行. 我们知道查阅文件属性的指令ls 完整文件名为:/ ...
- Vue.js 判断对象属性是否存,不存在添加
Vue.set是可以对对象添加属性的,这里item对象添加一个checked属性 //if(typeof item.checked=='undefined'){if(!this.item.checke ...
- Apache Hadoop YARN – NodeManager--转载
原文地址:http://zh.hortonworks.com/blog/apache-hadoop-yarn-nodemanager/ The NodeManager (NM) is YARN’s p ...
- hdfs源码分析第二弹
以写文件为例,串联整个流程的源码: FSDataOutputStream out = fs.create(outFile); 1. DistributedFileSystem 继承并实现了FileSy ...
- PHP 中数组获取不到元素
早上看到 SO 上一个有关 PHP 的问题,提问者描述有一个数组,使用 print_r 可以看到索引 key 和相对应的 value 都是存在的,但是访问该元素,不管是使用 array[key] 还是 ...
- C++解析(23):多态与C++对象模型
0.目录 1.多态 2.C++对象模型 2.1 使用C语言实现封装 3.继承对象模型 4.多态对象模型 4.1 使用C语言实现多态 5.小结 1.多态 面向对象中期望的行为: 根据实际的对象类型判断如 ...
- 洛谷 P3312 [SDOI2014]数表 解题报告
P3312 [SDOI2014]数表 题目描述 有一张\(N*M\)的数表,其第\(i\)行第\(j\)列(\(1\le i \le n\),\(1 \le j \le m\))的数值为能同时整除\( ...
- SQLite中的自增关键字:AUTO_INCREMENT、INTEGER PRIMARY KEY与AUTOINCREMENT
1.SQLite不支持关键字AUTO_INCREMENT 1)AUTO_INCREMENT不生效的问题 SQL语句: CREATE TABLE todo ( id INTEGER AUTO_I ...