大小号刷题,大号,被查重,悲剧,最后小号过了3题

A题:

分析:大于h的+2,小于等于h的+1

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
const int maxn=;
int a[maxn];
int n,h;
int main()
{
while(cin>>n>>h)
{
long long sum=;
for(int i=;i<n;i++){
int x;
scanf("%d",&x);
if(x>h)
sum+=;
else
sum+=;
}
cout<<sum<<endl;
}
return ;
}

B题:

题意:有n个长度分别为a1,a2.....an的木棒,每次可以削掉长度为k的,放入机器的最大长度不能大于h,一根接着一根地放入,问怎么才能用最少的次数

分析:看清题意发现是水题,一根接着一根放入,则我们判断一下上一根剩余的加上下一根的长度是否大于h,若大于,则只把剩余部分放入机器,否则把剩余部分和下一根一起放入机器

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
const int maxn=;
int a[maxn];
int k,n,h;
int main()
{
while(cin>>n>>h>>k)
{
memset(a,,sizeof(a));
for(int i=;i<n;i++)
scanf("%d",&a[i]);
int t,f;
long long cnt=;
for(int i=;i<n;i++){
t=a[i]/k; //需要几刀
f=a[i]%k; //切完之后当前这段还剩多少
cnt+=t;
if(a[i+]+f>h){ //不能切分
cnt++;
}else{ //可以切分
a[i+]+=f;
}
}
if(f) cnt++;
cout<<cnt<<endl;
}
return ;
}

C题:

题意:一个字符串里面的字符分别代表不同的数,字符串的每个数是由两个不同的数按位&得到的,问这样的组合最多有多少个

分析:若是0,则有0&0,1&0,0&1,3种,若是1只有1&1这1种,因此就是统计每个数的二进制有多少个0即可

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
const int mod=;
const int maxn=;
char str[maxn];
long long num[maxn];
long long solve(char s ){
long long x;
if(s>=''&&s<='')
x=s-'';
else if(s>='A'&&s<='Z')
x=s-'A'+;
else if(s>='a'&&s<='z')
x=s-'a'+;
else if(s=='-')
x=;
else
x=;
return x;
}
int main()
{ scanf("%s",str);
int n=strlen(str);
long long ans=;
for(int i=;i<n;i++){
long long x=solve(str[i]);
for(int j=;j<;j++){
if((x&(<<j))==)
ans=ans*%mod;
}
}
cout<<ans<<endl;
return ;
}

Codeforces#355的更多相关文章

  1. codeforces 355 div2 C. Vanya and Label 水题

    C. Vanya and Label time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  2. Codeforces Round #355 (Div. 2)-C

    C. Vanya and Label 题目链接:http://codeforces.com/contest/677/problem/C While walking down the street Va ...

  3. Codeforces Round #355 (Div. 2)-B

    B. Vanya and Food Processor 题目链接:http://codeforces.com/contest/677/problem/B Vanya smashes potato in ...

  4. Codeforces Round #355 (Div. 2)-A

    A. Vanya and Fence 题目连接:http://codeforces.com/contest/677/problem/A Vanya and his friends are walkin ...

  5. Codeforces Round #355 (Div. 2) D. Vanya and Treasure dp+分块

    题目链接: http://codeforces.com/contest/677/problem/D 题意: 让你求最短的从start->...->1->...->2->. ...

  6. E. Vanya and Balloons Codeforces Round #355 (Div. 2)

    http://codeforces.com/contest/677/problem/E 题意:有n*n矩形,每个格子有一个值(0.1.2.3),你可以在矩形里画一个十字(‘+’形或‘x’形),十字的四 ...

  7. D. Vanya and Treasure Codeforces Round #355 (Div. 2)

    http://codeforces.com/contest/677/problem/D 建颗新树,节点元素包含r.c.dis,第i层包含拥有编号为i的钥匙的所有节点.用i-1层更新i层,逐层更新到底层 ...

  8. Codeforces Round #355 (Div. 2) D. Vanya and Treasure 分治暴力

    D. Vanya and Treasure 题目连接: http://www.codeforces.com/contest/677/problem/D Description Vanya is in ...

  9. Codeforces Round #355 (Div. 2) C. Vanya and Label 水题

    C. Vanya and Label 题目连接: http://www.codeforces.com/contest/677/problem/C Description While walking d ...

随机推荐

  1. OpenGL--------纹理处理

    我们可以将像素数据按照矩形进行缩小和放大,但是还不足以满足我们的要求.例如要将一幅世界地图绘制到一个球体表面,只使用glPixelZoom这样的函数来进行缩放显然是不够的.OpenGL纹理映射功能支持 ...

  2. PHP AJAX技术

    AJAX 是一种在无需重新加载整个网页的情况下,能够更新部分网页的技术. AJAX 通过在后台与服务器进行少量数据交换,使网页实现异步更新.这意味着可以在不重载整个页面的情况下,对网页的某些部分进行更 ...

  3. UAC绕过思路(未完)

    ---恢复内容开始--- What is UAC?

  4. width为auto或者100%的区别

    一.四个理论 1. 某div不显示设置宽度,那么width为auto. 2. 某div的width在默认情况设置的是盒子模型中content的值 3. 某div的width为100%表示的是此div盒 ...

  5. AngularJS数据建模(转载)

    出处不明 我们知道,AngularJS并没有自带立等可用的数据建模方案.而是以相当抽象的方式,让我们在controller中使用JSON数据作为模 型.但是随着时间的推移和项目的成长,我意识到这种建模 ...

  6. 关于jdk环境变量配置成了1.6.0_39 32位jdk 的路径 cmd中java -version却还是显示 64位或者其他jdk 路径的解决方法

    其实是c盘或者其他盘的 jdk 安装的太多了,把其他的都卸载掉就行了

  7. 使用JQuery结合HIghcharts实现从后台获取JSON实时刷新图表

    项目做了一个报表,可以实时的观察呼叫中心的电话访问量,之前的版本是使用JFreechart做的,使用一段时间后出现内存溢出,服务器的内存使用量会变得很大,所以改用Ajax前台加载数据的方式实现实时报表 ...

  8. OpenGL学习-------visual studio 2010配置和第一个OpenGL程序讲解

    OpenGL作为当前主流的图形API之一,它在一些场合具有比DirectX更优越的特性. 1.与C语言紧密结合. OpenGL命令最初就是用C语言函数来进行描述的,对于学习过C语言的人来讲,OpenG ...

  9. 会员登录HTML

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><!DOCTYPE html PUBLIC "-//W ...

  10. JfreeCHart 异常:Chart image not found

    http://bbs.justep.com/thread-54775-1-1.html java.lang.IllegalArgumentException: Width (0) and height ...