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. e551. 精简的Applet

    Every applet must subclass Applet. import java.applet.*; import java.awt.*; public class BasicApplet ...

  2. Blend for Visual Studio 2013

    软件开发中为了使设计师和程序员“并行”工作并直接参与到程序的开发中来. 1.在网络程序开发团队中,草图设计后,设计师们可以使用HTML.CSS.JavaScript直接生成UI,程序员则在这个UI产生 ...

  3. Oracle查询优化-多表查询

    --合并结果集 --1.union all UNION ALL--单纯合并 ; --2.union UNION --将重复结果集合并 ; --------------使用命令窗口执行,查看union与 ...

  4. 转【翻译】怎样在Ubuntu 12.04上配置Apache SSL证书

    关于SSL证书 SSL证书是加密网站信息和创建一个更安全的连接的一种方式.另外,证书能够向网站訪问者展示VPS的身份信息. 证书颁发机构颁发SSL证书.用来验证server的具体信息,而一个自签名的证 ...

  5. .net cs后台刷新aspx页面的四种方式

    一:Response.Redirect(Request.Url.ToString()); 二:Response.Write("<script language=javascript&g ...

  6. ChemDraw加键的两种方法

    绘制化学结构离不开9种ChemDraw键工具,键工具在绘制过程中提供了最大的使用优势,这种优势体现在键角.键长的绘制,故很有必要学习相关的ChemDraw使用技巧.本ChemDraw教程将具体介绍在C ...

  7. 怎样用MathType创建竖式算法

    在使用MathType编辑公式时,有时将最简单的表达式变成Word文档也会出现一些问题.比如MathType竖式.下面介绍MathType竖式的一些编辑方法. 步骤如下: 步骤一:在MathType底 ...

  8. 【转】理清基本的git(github)流程

    概述 当我初次接触git时,我需要快速学习基本的git工作流,以便快速接收一个开源Web项目维护.但是,我很难理解工作流程,因为我不太了解git使用关键点. fork,clone,pull.branc ...

  9. app服务端server端数据库设计

  10. POJ 3211 Washing Cloths(01背包变形)

    Q: 01背包最后返回什么 dp[v], v 是多少? A: 普通01背包需要遍历, 从大到小. 但此题因为物品的总重量必定大于背包容量, 所以直接返回 dp[V] 即可 update 2014年3月 ...