Is Derek lying?
来源:互联网 发布:百度seo规则 编辑:程序博客网 时间:2024/06/05 15:21
DerekDerek and Alfia Alfia are good friends.Derek Derek is Chinese,and Alfia 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 N choice questions and each question is followed by three choices marked “A A” “B B” and “C C”.Each question has only one correct answer and each question is worth 1 1 point.It means that if your answer for this question is right,you can get 1 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 Derek the total score of him and Alfia Alfia.Then Alfia Alfia will ask Derek Derek the total score of her and he will tell her: “My total score is X X,your total score is Y Y.”But Derek Derek is naughty,sometimes he may lie to her. Here give you the answer that Derek Derek and Alfia Alfia made,you should judge whether Derek Derek is lying.If there exists a set of standard answer satisfy the total score that Derek Derek said,you can consider he is not lying,otherwise he is lying.
23 1 3AAAABC5 5 0ABCBCACBCB
Not lyingLying
这个题真心坑到我们队了,改了n多次,直接心态爆炸,前2小时一个题没做,第三个小时连A,
确实无语,交了十几次。最后还是一脸懵的A了这题。
说一下正确的思路:
总得分一定不大于n+ans,得分差一定不大于n-ans。
注意前面的一个条件n+ans
#include<bits/stdc++.h>using namespace std;char a[300010],b[300010];int main(){ int T; cin>>T; int n,da,db; while(T--) { int ans=0; scanf("%d%d%d",&n,&db,&da); scanf("%s",a); scanf("%s",b); for(int i=0;i<n;i++) if(a[i]==b[i]) ans++; if(da+db-2*ans<=(n-ans)&&(abs(da-db)<=n-ans))puts("Not lying"); else puts("Lying"); } return 0;}
阅读全文
0 0
- Is Derek lying?
- Is Derek lying?
- 1001.Is Derek lying?
- hdu6045 Is Derek lying
- HDU6045-Is Derek lying?
- Is Derek lying?
- HDU6045-Is Derek lying?
- Is Derek lying?
- Is Derek lying?
- hdu6045 Is Derek lying?
- Is Derek lying?
- Is Derek lying?
- Is Derek lying?
- Is Derek lying?
- Is Derek lying? HDU
- HDOJ 6045-Is Derek lying?
- hdu 6054-Is Derek lying?
- HDU 6045 Is Derek lying?
- LeetCode 453 Minimum Moves to Equal Array Elements
- CSU-ACM2017暑假集训比赛1 TD POJ3111
- POI实现海量数据导出到excel文件
- Xcode配置Python开发环境
- jdk环境的配置(Java编译环境)以及tomcat的安装
- Is Derek lying?
- SSH框架搭建步骤及思路
- hpuoj 【1341】统计奇偶数 【水题】
- pickle, cPickle 模块:序列化 Python 对象
- JS中client/offset/scroll等的宽高解析
- Java基础笔记整理---【01】cmd操作命令
- guava快速入门
- 机器学习:对于反向传播算法(backpropagation)的理解以及python代码实现
- <Python> Numpy中的矩阵乘法问题