A

题意:给出一串由.*组成的字符串,如果有等间距的五个及五个以上的*存在,则输出yes

直接枚举就可以了

看题一定要仔细啊,做的时候看成必须有五个等间距的".*"才可以跳跃= =

然后就这样写居然过了预测= =后来果然被hack了

 #include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
#define mod=1e9+7;
using namespace std; typedef long long LL;
const int INF = 0x7fffffff; int main(){
char s[];
int n,i,j;
scanf("%d",&n);
scanf("%s",s);
for(i=;i<n;i++){
for(j=;j<n;j++){
if(s[i]=='*'&&s[i+j]=='*'&&s[i+*j]=='*'&&s[i+*j]=='*'&&s[i+*j]=='*'){
printf("yes\n");
return ;
}
}
}
printf("no\n");
return ;
}

B

题意:如图所示,需要从根节点到最下面一层得叶子节点的灯的数量相等,问最少需要添加多少盏灯

因为需要每一条支路的灯的数量相等,所以从最下面一层开始处理((因为到分叉之前的灯都是共用的),不同的话加灯,相同的话继续往上一层处理

 #include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
#define mod=1e9+7;
using namespace std; typedef long long LL;
const int INF = 0x7fffffff;
int a[]; int mi(int x){
int ans=;
for(int i=;i<=x;i++) ans*=;
return ans;
} int main(){
int n,i,j,ans,k;
cin>>n;
int idx=mi(n+)-;
for(i=;i<=idx;i++) scanf("%d",&a[i]); ans=;
for(i=n;i>=;i--){
for(j=mi(i);j<=mi(i+)-;j=j+){
if(a[j]!=a[j+]) {
int tmp=a[j]-a[j+];
if(tmp<) tmp=-tmp;
ans+=tmp;
// printf("ans=%d\n",ans);
} int cc=max(a[j],a[j+]);
a[j/]+=cc;
}
} printf("%d\n",ans);
return ;
}

C

题意:给出容量c,蓝色的糖和红色的糖分别的快乐值v1,v2,分别的重量w1,w2 求最大的快乐值

做的时候想成背包,想到这么大的容量数组怎么开得下= =

后来暴力,枚举买蓝色糖的数目从1到100000000,超时

后来搜了题解= = 发下枚举到100000就可以了,另外要从0开始枚举,因为可能不吃这种糖果

 #include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
#define mod=1e9+7;
using namespace std; typedef long long LL;
const int INF = 0x7fffffff; int main(){
LL c,v1,v2,w1,w2,i;
cin>>c>>v1>>v2>>w1>>w2;
LL ans=-;
for(i=;i<=;i++){
LL y=(c-i*w1)/w2;
LL tmp=v2*y+i*v1;
if((c-i*w1)<=) break;
ans=max(ans,tmp);
} for( i=;i<=;i++){
LL y=(c-i*w2)/w1;
LL tmp=v2*i+v1*y;
if((c-i*w2)<=) break;
ans=max(ans,tmp);
}
if(ans<) printf("0\n");
else printf("%I64d\n",ans);
return ;
}

这个周六先做bc被虐成狗= =做cf被虐成狗---555555

加油啊---go--go--go--go--go--go

ZeptoLab Code Rush 2015的更多相关文章

  1. ZeptoLab Code Rush 2015 A. King of Thieves 暴力

    A. King of Thieves Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/526/pr ...

  2. CodeForces ZeptoLab Code Rush 2015

    拖了好久的题解,想想还是补一下吧. A. King of Thieves 直接枚举起点和5个点之间的间距,进行判断即可. #include <bits/stdc++.h> using na ...

  3. Codeforces - ZeptoLab Code Rush 2015 - D. Om Nom and Necklace:字符串

    D. Om Nom and Necklace time limit per test 1 second memory limit per test 256 megabytes input standa ...

  4. ZeptoLab Code Rush 2015 C. Om Nom and Candies 暴力

    C. Om Nom and Candies Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/526 ...

  5. ZeptoLab Code Rush 2015 B. Om Nom and Dark Park DFS

    B. Om Nom and Dark Park Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...

  6. Codeforces ZeptoLab Code Rush 2015 D.Om Nom and Necklace(kmp)

    题目描述: 有一天,欧姆诺姆发现了一串长度为n的宝石串,上面有五颜六色的宝石.他决定摘取前面若干个宝石来做成一个漂亮的项链. 他对漂亮的项链是这样定义的,现在有一条项链S,当S=A+B+A+B+A+. ...

  7. ZeptoLab Code Rush 2015 C. Om Nom and Candies [ 数学 ]

    传送门 C. Om Nom and Candies time limit per test 1 second memory limit per test 256 megabytes input sta ...

  8. ZeptoLab Code Rush 2015 B. Om Nom and Dark Park

    Om Nom is the main character of a game "Cut the Rope". He is a bright little monster who l ...

  9. Code Rush插件

    code rush 是微软推出的一款VS2008上的插件.他有强大的文件和代码导航功能,易于访问的重构和代码创建功能.一组编辑器.选择.剪贴板工具等. 教程链接 http://www.devexpre ...

随机推荐

  1. Libevent详细说明

    文章来自官方文档的部分翻译:http://www.wangafu.net/~nickm/libevent-book/ 通过这部分的了解,基本上可以使用libevent的常用功能了.有时间建议直接看官方 ...

  2. C#--判断当前是否是移动设备和设备的型号

    --如果是移动设备是true var ismobile = System.Web.HttpContext.Current.Request.Browser.IsMobileDevice; --设备型号( ...

  3. 错误 1 无法嵌入互操作类型“Microsoft.Office.Interop.Excel.ApplicationClass”。请改用适用的接口

    http://www.cnblogs.com/waitingfor/archive/2011/12/19/2293469.html

  4. Linux中ping命令

    Linux系统的ping命令是常用的网络命令,它通常用来测试与目标主机的连通性,我们经常会说“ping一下某机器,看是不是开着”.不能打开网页时会说“你先ping网关地址192.168.1.1试试”. ...

  5. Properties读取资源文件的四种方法

    package com.action; import java.io.InputStream; import java.util.Locale; import java.util.Properties ...

  6. 批处理命令 - if

    0.功能 Performs conditional processing in batch programs. 执行批处理程序中的条件处理. 1.简介 IF [NOT] ERRORLEVEL numb ...

  7. Android 核心分析之十二Android GEWS窗口管理之基本架构原理

    Android GWES之窗口管理之基本构架原理 Android的窗口管理是C/S模式的.Android中的Window是表示Top Level等顶级窗口的概念.DecorView是Window的To ...

  8. Linux基础--例行工作

    1.仅进行一次的工作排程--at at的工作情况其实是这样的: 1)先找寻/etc/at.allow这个档案,写在这个档案中的使用者才能使用at,没有在这个档案中的使用者则不能使用at(即使没有写在a ...

  9. 根据ip查询地区,经纬度等-geoip2

    这项工作难度主要在数据上,数据越准确越有利. 1. 下载数据文件: http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.m ...

  10. JBoss7配置指南

    JBoss7配置指南   1.    jboss各主要版本特性... 3 1.1.     jboss4特性... 3 1.2.     jboss5特性... 5 1.3.     jboss6特性 ...