hdu6045
来源:互联网 发布:某人被告知做某事 编辑:程序博客网 时间:2024/06/06 05:36
Is Derek lying?
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 626 Accepted Submission(s): 359
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思路:这题其实只要判断相同的字母数是否在两人对的题目和减去总题数和总题数减去来两人对的差的绝对值之间,如果在就输出“Not lying”。代码:#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#include <cmath>#include <stdlib.h>#include <vector>#include <queue>#include <stack>using namespace std;const int MOD=1e9+7;vector<int>a1;vector<int>a2;int v[100005];int main(){ int T; cin>>T; while(T--) { int N,x,y; scanf("%d %d %d",&N,&x,&y); int c=x+y-N; int d=N-abs(x-y); char a[80005],b[80005]; int i; scanf("%s%s",a,b); int k=0; for(i=0;i<N;i++) { if(a[i]==b[i]) { k++; } } if(k<=d&&k>=c) { cout<<"Not lying"<<endl; } else cout<<"Lying"<<endl; } return 0;}
阅读全文
0 0
- hdu6045
- hdu6045 Is Derek lying
- HDU6045-Is Derek lying?
- HDU6045-Is Derek lying?
- HDU6045(数学公式)
- hdu6045 Is Derek lying?
- hdu6045-思维-Is Derek lying?
- HDU6045 2017 Multi-University Training Contest
- HDU6045(此题有坑,拉低了A率)
- Hdu6045 Is Derek lying?(2017多校第2场)
- 2017多校2(hdu6045)Is Derek lying?
- hdu6045 17多校1001 Is Derek lying? 思维 签到
- 2017多校训练第二场 hdu6045 Is Derek lying
- 2017暑期多校 HDU6045 Is Derek lying?
- 2017多校训练Contest2: 1001 Captain is coding hdu6045
- 【多校联合】(HDU6045)Is Derek lying?
- HDU6045 Is Derek lying?(规律,2017 HDU多校联赛 第2场)
- hdu6045 Is Derek lying? -逻辑题-2017多校联盟2 1题
- C++中的隐藏、重载、覆盖(重写)
- 【Hadoop入门】Hadoop2.8的安装步骤
- Servlet 8个Listener
- Google发布RAISR
- 【JAVA学习】“-Xmx1024m -Xms1024m -Xmn512m -Xss256k”——Java运行参数
- hdu6045
- Mysql的分页limit (startNum从0开始,pageSize) limit 1即查询最新的一条(相当于limit(0,1))
- Git与TortoiseGit基本操作
- NOIP2016 T2 天天爱跑步
- hdu 5692 (节点深度为h 所有子节点
- thinkPHP5多数据库连接,跨数据连接查询
- [译]The Python Tutorial#11. Brief Tour of the Standard Library — Part II
- A. Mafia----二分答案
- 20年的Flash要退出舞台:当年哪个小游戏你最爱?