A

弯腰

 #include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std;
#define clc(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
const int N=;
#define LL long long
// inline int r(){
// int x=0,f=1;char ch=getchar();
// while(ch>'9'||ch<'0'){if(ch=='-') f=-1;ch=getchar();}
// while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
// return x*f;
// } int main(){
int n,m;
int ans=;
scanf("%d%d",&n,&m);
for(int i=;i<n;i++){
int x;
cin>>x;
if(x<=m)
ans+=;
else
ans+=;
}
cout<<ans<<endl;
return ;
}

B

处理器一秒能处理k个东西,缓冲区最多不能超过h个,问几秒处理完

模拟,注意h很大,k很小的情况!!所以必须用除法避免超时

 #include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std;
#define clc(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
const int N=;
#define LL long long
void fre(){freopen("in.txt","r",stdin); }
// inline int r(){
// int x=0,f=1;char ch=getchar();
// while(ch>'9'||ch<'0'){if(ch=='-') f=-1;ch=getchar();}
// while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
// return x*f;
// }
int a[]; int main(){
// fre();
int n,h,k;
cin>>n>>h>>k;
for(int i=;i<=n;i++){
scanf("%d",&a[i]);
}
LL sum=;
LL ans=;
for(int i=;i<=n;i++){
sum+=a[i];
while(sum+a[i+]<=h){
sum+=a[i+];
i++;
if(i>n)
break;
}
// cout<<i<<" "<<sum<<endl;
while(){
int tem=sum;
sum%=k;
ans+=tem/k;
if(sum<=)
{
sum=;
break;
}
if(i<n){
if(sum+a[i+]<=h)
break;
}
if(sum<k&&sum>){
sum=;
ans++;
// cout<<sum<<" "<<ans<<endl;
break;
}
}
// cout<<i<<" "<<sum<<endl;
}
cout<<ans<<endl;
return ;
}

C

统计每个字符对应的数字有几个0,答案就是pow(3,n)。二进制是六位

 #include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std;
#define clc(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
const int N=;
const int MOD = 1e9+;
#define LL long long
void fre(){freopen("in.txt","r",stdin); }
// inline int r(){
// int x=0,f=1;char ch=getchar();
// while(ch>'9'||ch<'0'){if(ch=='-') f=-1;ch=getchar();}
// while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
// return x*f;
// }
LL pow_m(LL a,LL b)
{
LL ans = ;
a %= MOD;
while(b)
{
if(b & )
{
ans = ans * a % MOD;
b--;
}
b >>= ;
a = a * a % MOD;
}
return ans;
} int fun(int x){
int num=;
int cnt=;
while(cnt){
if((x&)==)
num++;
x>>=;
cnt--;
}
return num;
}
string s;
bool vis[];
int main(){
// freopen("in.txt","r",stdin);
getline(cin,s);
LL num=;
LL ans=;
clc(vis,false);
for(int i=;i<s.length();i++){
int x;
if(s[i]>=''&&s[i]<=''){
x=s[i]-'';
num+=fun(x);
}
else if(s[i]>='A'&&s[i]<='Z'){
x=s[i]-'A'+;
num+=fun(x);
}
else if(s[i]>='a'&&s[i]<='z'){
x=s[i]-'a'+;
num+=fun(x);
}
else if(s[i]=='-'){
num+=fun();
}
else{
num+=fun();
}
}
// cout<<num<<endl;
ans=pow_m(,num);
printf("%I64d\n",ans);
return ;
}

Codeforces Round #355 (Div. 2)的更多相关文章

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

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

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

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

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

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

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

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

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

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

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

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

  7. 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 ...

  8. 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 ...

  9. Codeforces Round #355 (Div. 2) B. Vanya and Food Processor 水题

    B. Vanya and Food Processor 题目连接: http://www.codeforces.com/contest/677/problem/B Description Vanya ...

  10. Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题

    A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...

随机推荐

  1. C#中 Thread.Sleep精度问题

    Thread.Sleep的精度默认在15ms左右,如果需要类似 Thread.Sleep(1)的精细控制,需要调用特定的平台API实现 [DllImport("winmm.dll" ...

  2. Codeforces Round #260 (Div. 1) C. Civilization 树的中心+并查集

    题目链接: 题目 C. Civilization time limit per test1 second memory limit per test256 megabytes inputstandar ...

  3. myeclipse报错:Could not create the view: An unexpected exception was thrown.

    打开server窗口,发现显示:Could not create the view: An unexpected exception was thrown. 此处解决方法: 关闭myeclipse 删 ...

  4. 阿里云,CentOS下yum安装mysql,jdk,tomcat

    首先说明,服务器是阿里云的,centos6.3_64位安全加固版.首先需要登陆进来,使用的是putty,因为最初的时候,Xshell登陆会被拒绝. 0. 创建个人文件夹 # 使用 yum 安装tomc ...

  5. 关于static继承的问题

    c++primer 15.2.7节关于static继承的意思是,父类和子类共享static函数或者static成员变量,并且子类要访问还要受它们的权限限制,下面是看到的另一个例子 class Base ...

  6. 并发下常见的加锁及锁的PHP具体实现

    http://www.cnblogs.com/scotoma/archive/2010/09/26/1836312.html Apache + PHP 的并发访问 http://www.cnblogs ...

  7. 二维图形的矩阵变换(三)——在WPF中的应用矩阵变换

    原文:二维图形的矩阵变换(三)--在WPF中的应用矩阵变换 UIElement和RenderTransform 首先,我们来看看什么样的对象可以进行变换.在WPF中,用于呈现给用户的对象的基类为Vis ...

  8. Razor视图引擎布局

    不需要像过去aspx一样,使用.Master文件,而是统一使用.cshtml 或 .vbhtml文件.但文件名一般以 _开头,这样做文件不会当做View显示出来 使用@RenderBody() 表示替 ...

  9. Call to undefined function pg_

    网上普遍的解决方案: 1.修改php.ini文件, 添加php_pgsql.dll扩展 2.如果是wamp这样类似的软件,可以直接通过图形化操作 这样操作后,大部分RD都是没有问的...但是为什么还提 ...

  10. 用PHP尝试RabbitMQ(amqp扩展)实现消息的发送和接收

    消费者:接收消息 逻辑:创建连接-->创建channel-->创建交换机-->创建队列-->绑定交换机/队列/路由键-->接收消息 <?php /********* ...