hdu 6045 多校签到题目
http://acm.hdu.edu.cn/showproblem.php?pid=6045
题解:遍历一遍,求出两个人答案中相同的个数,用wa表示。然后我从大的数入手,当wa的数都尽可能在两个人答案的相同部分时,另一个人的答案中对的个数最小;当wa的数尽可能在两者答案不同的部分的时候,另一个人的答案对的个数最多。
ac代码:
#include <cstdio>
#include <iostream>
#include <queue>
using namespace std;
int main()
{
cin.sync_with_stdio(false);
int t;
cin>>t;
while(t--)
{
int n,x,y;
cin>>n>>x>>y;
string a;
string b;
cin>>a;
cin>>b;
int ret=;
for(int i=;i<n;i++)
{
if(a[i] == b[i] ) ret++;
}
int same=ret;
int nosame=n-ret;
int maxx=max(x,y);
int minn=min(x,y);
int wa=n-maxx;
int l,r;
if(same < wa) l=;
else l=same-wa;
r=same+wa;
if(l<=minn && minn <=r) cout<<"Not lying"<<endl;
else cout<<"Lying"<<endl;
}
return ;
}
hdu 6045 多校签到题目的更多相关文章
- hdu 6077多校签到
#include <iostream> #include <cstdio> using namespace std; ][]; int f(int pos) { ; ;i< ...
- HDU 6045 - Is Derek lying | 2017 Multi-University Training Contest 2
/* HDU 6045 - Is Derek lying [ 分析 ] 题意: 有N个问题, 每个问题有A,B,C三种答案,答对加一分,答错不加分 给出甲乙两人的答案,给出两人的分数先x, y,问分数 ...
- hdu 动态规划(46道题目)倾情奉献~ 【只提供思路与状态转移方程】(转)
HDU 动态规划(46道题目)倾情奉献~ [只提供思路与状态转移方程] Robberies http://acm.hdu.edu.cn/showproblem.php?pid=2955 背包 ...
- NC14583 糖糖别胡说,我真的不是签到题目
NC14583 糖糖别胡说,我真的不是签到题目 题目 题目描述 从前,有 \(n\) 只萌萌的糖糖,他们分成了两组一起玩游戏.他们会排成一排,第 \(i\) 只糖糖会随机得到一个能力值 \(b_i\) ...
- HDU 6045 17多校2 Is Derek lying?
题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6045 Time Limit: 3000/1000 MS (Java/Others) Memory ...
- 2017ACM暑期多校联合训练 - Team 2 1001 HDU 6045 Is Derek lying? (模拟)
题目链接 Problem Description Derek and Alfia are good friends.Derek is Chinese,and Alfia is Austrian.Thi ...
- hdu 6045: Is Derek lying? (2017 多校第二场 1001)【找规律】
题目链接 可以暴力找一下规律 比如,假设N=7,两人有5题相同,2题不同,枚举X=0->15时,Y的"Not lying"的取值范围从而找出规律 #include<bi ...
- HDU 6045 Is Derek lying?
题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=6045 题目: Is Derek lying? Time Limit: 3000/1000 MS (Ja ...
- HDU - 5753 多校联萌3-2
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5753 Sample Input Sample Output 6.000000 52.833333 分析 ...
随机推荐
- 一个简单的puppeteer爬虫
const puppeteer = require("puppeteer"); const path = require('path'); const pathToExtensio ...
- CISCO实验记录十一:switch端口安全配置
1.启用交换机端口安全 2.限制端口最大访问量为1,超出后关闭端口 1.启用交换机端口安全 #interface gigabitEthernet 0/1 #switchport mode access ...
- 字符串匹配 - hash
之前有写过一篇hash表,不过那是非常久远的时候了,应该是大一刚学一个学期的时候的成果,后来也就不那样写了,后来从xiaoxin那里学习了hash的写法,比较容易用也比较方便多hash,就这样. 分别 ...
- Winform 工程反编译后窗体如何显示
Winform反编译后,如果想要让它象正常的工程一样,可以在窗体编辑器中,编辑,需要做一些工作. 1. 转换.resources 为 .resx 利用resgen工具.这个工具是vs自带的. 在启动 ...
- python中的cls到底指的是什么
python中的cls到底指的是什么,与self有什么区别? 2018年07月31日 11:13:09 rs勿忘初心 阅读数:7769 作者:秦风链接:https://www.zhihu.com/ ...
- android设置gps自动开启
1.第一种方法 private void toggleGPS() { Intent gpsIntent = new Intent(); gpsIntent.setClassName("com ...
- 用SSMS连接Azure Sql Database 与连接本地库的一些操作区别
背景 我们知道Azure Sql Database 可以降低运维成本.是一种Pass模式,有资源弹性设置,可以自由调整资源自动对应不同业务高峰(当然也可以降低费用成本),也方便项目后期的资源扩展,以及 ...
- (转)svn执行clean up命令时报错“Previous operation has not finished; run 'cleanup' if it was interrupted”
今天碰到了个郁闷的问题,svn执行clean up命令时报错“Previous operation has not finished; run 'cleanup' if it was interrup ...
- 安装flask_mysqldb出现报错问题解析
安装 mysqldb (pip3 install Flask-MySQLdb)报错 EnvironmentError: mysql_config not found ERROR: Command er ...
- 在vue项目中获取当前城市
在vue项目中使用百度地图获取当前城市:https://www.jianshu.com/p/0819cfd46712 Vue2 :百度地图bmap:https://www.jianshu.com/p/ ...