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. 关于document.createDocumentFragment()(转)

    documentFragment 是一个无父对象的document对象. 他支持以下DOM2方法: appendChild, cloneNode, hasAttributes, hasChildNod ...

  2. 【Java面试题】42 TreeSet里面放对象,如果同时放入了父类和子类的实例对象,那比较时使用的是父类的compareTo方法,还是使用的子类的compareTo方法,还是抛异常!

    应该是没有针对问题的确切的答案,当前的add方法放入的是哪个对象,就调用哪个对象的compareTo方法,至于这个compareTo方法怎么做,就看当前这个对象的类中是如何编写这个方法的 试验如下: ...

  3. 获取pc硬件信息杂记

    //Download by http://www.NewXing.com #include "StdAfx.h" #include "RegUtil.h" #i ...

  4. 如何让View一直沿z轴旋转

    #import <QuartzCore/QuartzCore.h>... CABasicAnimation *rotationAni = [CABasicAnimation animati ...

  5. 对ChemDraw Professional 16.0你了解多少

    ChemDraw Professional 16.0组件为科学家提供了最新的科学智能应用程序组件,绘制化学结构图和分析生物路径图.  ChemDraw Professional 16.0 ChemDr ...

  6. 无法在Word中打开MathType怎么办

    MathType是一种数学公式编辑器,通常我们都是与Office文档配合使用,但是如果大家在Word中使用MathType编辑公式时,遇到MathType无法打开的情况,我们应该怎么办?下面我们就针对 ...

  7. win7 64位下android开发环境的搭建

    本文转自:http://www.cfanz.cn/index.php?c=article&a=read&id=65289 最近换了新电脑,装了win7 64位系统,安装了各种开发环境, ...

  8. Linux 远程同步:rsync

    rsync 简介: (1) rsync 是一个远程数据同步工具,可通过 LAN/WAN 快速同步多台主机间的文件(2) rsync 使用所谓的“rsync算法”来使本地和远程两个主机之间的文件达到同步 ...

  9. Effective C++ —— 资源管理(三)

    条款13 : 以对象管理资源 假设有如下代码: Investment* createInvestment(); //返回指针,指向Investment继承体系内的动态分配对象,调用者有责任删除它 vo ...

  10. Runtime应用(三)实现NSCoding的自动归档和自动解档

    当我们需要将一个对象进行归档时,都要让该对象的类遵守NSCoding协议,再实现归档和接档方法.例如有一个Person类,该类有两个成员变量 @property (nonatomic,copy) NS ...