A. Bark to Unlock

题目链接:http://codeforces.com/contest/868/problem/A

题目意思:密码是两个字符组成的,现在你有n个由两个字符组成的字符串,现在问是否可以用你手上的这些字符串通过拼接其中两个的基础上使得密码是这个拼接而成的字符串的子串,一个字符串可以使用多次,这意味这自己拼接自己也是可以的。

题目思路:暴力枚举这个过程,因为总共就n最大也就100

代码:

 /* ***********************************************
Author :xiaowuga
Created Time :2017年10月05日 星期四 15时07分23秒
File Name :A.cpp
************************************************ */
#include <bits/stdc++.h>
typedef long long LL;
#define endl "\n"
#define inf 0x3f3f3f3f
const long long N=;
const long long mod=1e9+;
using namespace std;
int main(){
ios::sync_with_stdio(false);cin.tie();
string q;
cin>>q;
int n;
cin>>n;
string a[];
for(int i=;i<n;i++) cin>>a[i];
for(int i=;i<n;i++){
for(int j=i;j<n;j++){
string s=a[i]+a[j];
if(s.find(q)!=string::npos){
cout<<"YES"<<endl;
return ;
}
string ss=a[j]+a[i];
if(ss.find(q)!=string::npos){
cout<<"YES"<<endl;
return ;
}
}
}
cout<<"NO"<<endl;
return ;
}

B. Race Against Time

题目链接:http://codeforces.com/contest/868/problem/B

题目意思:现在时间停止了。给你一个时间,表示现在指针在钟面上的分布情况,问点a是否可以到达点b(如果点a无法到达b说明,不管a顺时针走还是逆时针走都是碰到指针,以至于无法到达B)。

题目思路:这个题目有一个坑点导致wa了很多人,就是比如十点四十五分三十秒,我们发现时针和秒针都不是在刚好整格的地方,这就说明这个题需要一个精度问题。所以我们把分针和秒针的贡献都算在时针上,秒针对分针的贡献算在分针上,然后看一下,如果是三个指针都在ab点之间就说明可以到达,否则不行。

代码:

 /* ***********************************************
Author :xiaowuga
Created Time :2017年10月05日 星期四 15时37分27秒
File Name :B.cpp
************************************************ */
#include <bits/stdc++.h>
typedef long long LL;
#define endl "\n"
#define inf 0x3f3f3f3f
const long long N=;
const long long mod=1e9+;
using namespace std;
double a[]={,,,,,,,,,,,,};
int main(){
ios::sync_with_stdio(false);cin.tie();
int hh,tt1,tt2;
double m,s;
cin>>hh>>m>>s>>tt1>>tt2;
double h=a[hh]+1.0**m/+1.0**s/;
m=m+1.0*s/;
int t1=a[tt1];
int t2=a[tt2];
int c1=,c2=;
if(t1>t2) swap(t1,t2);
if(h>t1&&h<t2) c1++;
else c2++;
if(m>t1&&m<t2) c1++;
else c2++;
if(s>t1&&s<t2) c1++;
else c2++;
if(c1==||c2==) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return ;
}

C. Qualification Rounds

题目链接:http://codeforces.com/contest/868/problem/C

题目意思:有k个队伍n个题目,现在要从n个问题中找到一个子集,使得k个队伍中没有一个队伍会做这个子集中超过一半题目。

题目思路:只要出两个题目就可以了,把每道题的掌握情况压成一个十进制数,然后暴力枚举所有的数,看一下是否有两个数&在一起为0。保证会做其中一道题的一定不会做另一到题。

代码:

 /* ***********************************************
Author :xiaowuga
Created Time :2017年10月05日 星期四 18时02分29秒
File Name :C.cpp
************************************************ */
#include <bits/stdc++.h>
typedef long long LL;
#define endl "\n"
#define inf 0x3f3f3f3f
const long long N=;
const long long mod=1e9+;
using namespace std;
int a[];
vector<int>b;
int main(){
ios::sync_with_stdio(false);cin.tie();
int n,k;
cin>>n>>k;
for(int i=;i<n;i++){
int sum=;
for(int j=;j<k;j++){
sum*=;
int t;
cin>>t;
sum+=t;
}
a[sum]++;
}
for(int i=;i<=(<<k);i++) if(a[i]) b.push_back(i);
if(b[]==){cout<<"YES"<<endl;return ;}
for(int i=;i<b.size()-;i++){
for(int j=i+;j<b.size();j++){
int t=b[i]&b[j];
if(!t){ cout<<"YES"<<endl;return ;}
}
}
cout<<"NO"<<endl;
return ;
}

Codeforces Round #438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined)的更多相关文章

  1. D. Huge Strings Codeforces Round #438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined)

    http://codeforces.com/contest/868/problem/D 优化:两个串合并 原有状态+ 第一个串的尾部&第二个串的头部的状态 串变为第一个串的头部&第二个 ...

  2. Codeforces Round #438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combine

    最近只想喊666,因为我是真得菜,大晚上到网吧打代码还是很不错的嘛 A. Bark to Unlock time limit per test 2 seconds memory limit per t ...

  3. Qualification Rounds(Codeforces Round #438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined)+状态压缩)

    题目链接 传送门 题意 现总共有\(n\)个题目\(k\)支参赛队伍,已知每个题目各队伍是否会写,现问你能否从题目中选出一个子序列使得每支队伍最多只会写一半的题目. 思路 对于每个题目我们用二进制压缩 ...

  4. Codeforces Round #438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined) A,B,C【真的菜·】

    8说了 #include<bits/stdc++.h> using namespace std; #define int long long signed main(){ string s ...

  5. Codeforces Round #438 (Div.1+Div.2) 总结

    本来兴致勃勃的想乘着这一次上紫,于是很早很早的到了机房 但是好像并没有什么用,反而rating-=47 Codeforces Round #438(Div.1+Div.2) 今天就这样匆匆的总结一下, ...

  6. Codeforces Round #438 B. Race Against Time

    Description Have you ever tried to explain to the coordinator, why it is eight hours to the contest ...

  7. Codeforces Round #438 C. Qualification Rounds

    Description Snark and Philip are preparing the problemset for the upcoming pre-qualification round f ...

  8. Codeforces Round #438 C - Qualification Rounds 思维

    C. Qualification Rounds time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  9. Codeforces Round #438 D. Huge Strings

    Description You are given n strings s1, s2, ..., sn consisting of characters 0 and 1. m operations a ...

随机推荐

  1. 剑指offer_面试题5_从尾到头打印链表(栈和递归实现)

    题目:输入一个链表的头结点,从尾到头反过来打印出每一个节点的值 考察 单链表操作.栈.递归等概念. 理解:要实现单链表的输出,那么就须要遍历.遍历的顺序是从头到尾.而节点输出的顺序是从尾到头.因此,先 ...

  2. R语言绘图边框的单位

    在R语言中指定画图边框时,通常使用两种单位, lines 和 inches 当然,这两个单位之间是可以相互转换的,那么 1 inch = ? line 答案是1 inches = 5 lines 下面 ...

  3. R语言低级绘图函数-symbols

    严格意义上将symbols 并不能算是一个低级的绘图函数,因为它不仅可以在一幅已经存在的图标上添加元素,还可以创建一张新的图表 鉴于它绘图时的灵活性,我把它归入到低级绘图函数中 symbols 可以创 ...

  4. CentOS系统中last命令的作用

    CentOS系统中last命令的作用是显示近期用户或终端的登录情况,它的使用权限是所有用户.通过last命令查看该程序的log,管理员可以获知谁曾经或企图连接系统. 格式 last [—R] [—n] ...

  5. js 文件下载

    工程WebApi: 点击按钮执行的handler exportClick() { var profile = { content: this.state.profile, type: MappingT ...

  6. eclipse (ADT) svn插件 过滤上传的 文件 文件夹 一劳永逸

    其实很简单哈,过滤的有三种类型,1.文件.2.文件夹.3.android的target 在ADT中 window->preferences-> 会打开如下界面 ignore就是忽视的意思 ...

  7. 扒一扒MathType不为人知的技巧

    MathType作为一款编辑数学公式的神器,很多人在使用它时只是很简单地使用了一些最基本的模板,很多功能都没有使用.MathType功能比你想象中的大很多,今天我们就来扒一扒MathType那些不为人 ...

  8. Office密码破解不求人!

    你用Office吗?你会为你的Office文档加密吗?如果Office密码忘了求人吗?最后一个问题是不是让你很头大,求人办事不是要费钱就是要靠人情,不如自己拥有一款强大的密码破解工具,想要Office ...

  9. 搭建 FTP 文件服务vsftpd

    安装并启动 FTP 服务 安装 VSFTPD 使用 yum 安装 vsftpd: yum install vsftpd -y vsftpd 是在 Linux 上被广泛使用的 FTP 服务器,根据其[官 ...

  10. 服务端用例设计的思(tao)路!

    服务端的测试简单来说就是除了前端以外的的测试. 总的来说可以分为以下两类: 1.     WEB或者APP的提供业务逻辑的服务端接口测试 2.     数据库.缓存系统.中间件..jar包依赖.输入输 ...