17 多校
来源:互联网 发布:seo实战密码电子书 编辑:程序博客网 时间:2024/06/05 12:01
Is Derek lying?
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 22 Accepted Submission(s): 15
Problem Description
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 integersN ,X ,Y ,the meaning is mentioned above.
The second line consists ofN characters,each character is “A ” “B ” or “C ”,which represents the answer of Derek for each question.
The third line consists ofN 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
For each test case,there will be three lines.
The first line consists of three integers
The second line consists of
The third line consists of
Data Range:
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 ”.
Please print “
Sample Input
23 1 3AAAABC5 5 0ABCBCACBCB
Sample Output
Not lyingLying
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6045
题意:给出两个人的选项和他们所得的分数,判断是否有人撒谎。
记两人答案相同的题目个数为A,答案不同的个数为B,题目总数为N,两人分别所得分数为X,Y,可以得到 X+Y > N + A 时一定有人撒谎了,因为答案不同的只能有其中一个人对,所以最大的分数和就是N+A。当一题中两人选项不同时有三种情况,一种是第一人对,还有是第二人对,或两人均错,所以两人的分差若大于B则其中有人说了假话,即abs( X+Y ) > B 时有人撒谎。
#include<iostream>#include<string.h>#include<stdio.h>using namespace std;int t,n,x,y,same;char s1[80100],s2[80100];int main(){ scanf("%d",&t); while(t--) { scanf("%d%d%d",&n,&x,&y); scanf("%s%s",s1,s2); same = 0; for(int i=0;i<n;i++) { if(s1[i]==s2[i]) same ++; } if(same+n>=x+y&&abs(x-y)<=n-same) printf("Not lying\n"); else printf("Lying\n"); } return 0;}
阅读全文
0 0
- 17 多校
- 17 多校
- 17 多校
- 17 多校
- 17 多校
- 17 多校
- 17 多校
- 17多校contest 1
- 17 多校 3
- 17 多校 3
- 17 多校 3
- 17 多校 3
- 17 多校 4
- 17 多校 4
- 17多校contest 6- 1003 Inversion ( 模拟
- 多校
- 多校
- 多校
- 希尔排序
- 在Spring中配置Quartz
- 字符串难题
- Android 代码中AddView 使用anko
- Java synchronized 关键字使用方法
- 17 多校
- 运算符重载中的隐式转换问题
- Springmvc整合Spring(十)
- SQL各种连接查询详解
- 装箱和拆箱,将字符串转化成包装类的方法
- 关于waitpid的使用问题,记录下
- TensorFlow
- Android中传统的SQLite使用方式
- 由c#程序中的static Main() 浅谈 static的含义