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 ...
随机推荐
- 分页---Vue+.net+bootstrap实现
通过学习Vue,的确觉的Vue的双向绑定使用起来十分方便,因此研究了一下列表显示时分页的实现,这里我使用了bootstrap的样式,所以在页面中引用bootstrap的样式文件,后台提数据源使用.ne ...
- codeforces 1027 E. Inverse coloring (DP)
E. Inverse Coloring time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- [AT2363] [agc012_c] Tautonym Puzzle
题目链接 AtCoder:https://agc012.contest.atcoder.jp/tasks/agc012_c 洛谷:https://www.luogu.org/problemnew/sh ...
- BZOJ2733 永无乡 【splay启发式合并】
2733: [HNOI2012]永无乡 Time Limit: 10 Sec Memory Limit: 128 MB Submit: 4190 Solved: 2226 [Submit][Sta ...
- Redis的Sorted Set有序集合命令
Sorted Set是Set的一个升级版本,它在Set的基础上增加了一个顺序属性,这一属性在添加修改元素的时候可以指定,每次指定后,zset会自动重新按新的值调整顺序.可以理解为有两列的mysql表, ...
- Introducing my blog
作为一名计算机专业的学生,在我的博客中我会记录以下几方面的内容: 1.在阅读各类专业书籍的过程中,遇到了一些自己通过很大努力才思考.解决出来的问题/知识/概念,我会通过我自己的讲解将这些问题较为全面. ...
- centos上部署git
安装Git #安装依赖环境 [root@wys01 wys]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib- ...
- 【生成树,堆】【CF1095F】 Make It Connected
Description 给定 \(n\) 个点,每个点有点权,连结两个点花费的代价为两点的点权和.另外有 \(m\) 条特殊边,参数为 \(x,y,z\).意为如果你选择这条边,就可以花费 \(z\) ...
- 洛谷P3048 [USACO12FEB]牛的IDCow IDs
P3048 [USACO12FEB]牛的IDCow IDs 12通过 67提交 题目提供者lin_toto 标签USACO2012 难度普及/提高- 时空限制1s / 128MB 提交 讨论 题解 ...
- STL源码分析归档
1) algorithm 2) traits 3) iterator 4) list 5) function 6) rbtree 7) bitset 8) priority_queue 9) hash ...