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. NWR协议

    NWR是一种在分布式存储系统中用于控制一致性级别的一种策略.在Amazon的Dynamo云存储系统中,就应用NWR来控制一致性. 让我们先来看看这三个字母的含义:N:在分布式存储系统中,有多少份备份数 ...

  2. main函数和启动例程

    为什么汇编程序的入口是_start,而C程序的入口是main函数呢?本节就来解释这个问题.在讲例 18.1 “最简单的汇编程序”时,我们的汇编和链接步骤是: $ as hello.s -o hello ...

  3. 在Delphi中实现动画窗口

    Windows下有一个函数AnimateWindow,在Delphi自带的Win32 API Help中是找不到的.你可以在Delphi的编辑器中输入windows.等待代码向导出来,继续输入Anim ...

  4. ZJU 1180 Self Numbers(暴力模拟判断,水题)

    题目链接 同HDU 1128 , POJ 1316(这个范围小一点). 原本怕超时,以为有技巧或者规律,死命的想,后来发现这就是一道水体,模拟着全部判断一下就好了,10秒呢,完全不怕超时...唔,废话 ...

  5. 调用MYSQL存储过程实例

    PHP调用MYSQL存储过程实例 http://blog.csdn.net/ewing333/article/details/5906887 http://www.cnblogs.com/kkchen ...

  6. SQL技术内幕-10 in和exists 性能比较

    in和exists in 是把外表和内表作hash 连接,而exists是对外表作loop循环,每次loop循环再对内表进行查询. 一直以来认为exists比in效率高的说法是不准确的. 如果查询的两 ...

  7. URAL 1183 Brackets Sequence(DP)

    题目链接 题意 : 给你一串由括号组成的串,让你添加最少的括号使该串匹配. 思路 : 黑书上的DP.dp[i][j] = min{dp[i+1][j-1] (sh[i] == sh[j]),dp[i] ...

  8. ExtJs之文本框及数字输入

    结合HTML来理解, 比较容易. <!DOCTYPE html> <html> <head> <title>ExtJs</title> &l ...

  9. 浅析dex文件加载机制

    我们可以利用DexClassLoader来实现动态加载dex文件,而很多资料也只是对于DexClassLoader的使用进行了介绍,没有深入讲解dex的动态加载机制,我们就借助于Android4.4的 ...

  10. 使用git整体流程

    一.git提交代码走meger请求的整体流程 工作中使用git推代码时,如果走merge请求,那么也就是说拉代码时拉公共代码库的代码,但是提交时需要先提交到自己的代码库,然后在gitlab上提交mer ...