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. mysql 跨库JOIN

    现有两台MYSQL数据库 一台是192.168.1.1 端口3306 上有数据库DB1 有表TABLE1一台是192.168.1.2 端口3307 上有数据库DB2 有表TABLE2192.168.1 ...

  2. 盘点 OSX 上最佳的 DevOps 工具

    [编者按]对于运维人员来说,他们往往需要各种各样的工具来应对工作需求,近日 Dustin Collins 通过「The Best DevOps Tools on OSX」一文对 OSX 平台上的工具进 ...

  3. C++: 单例模式和缺陷

    C++: 单例模式和缺陷 实现一个单例模式 1 class Singleton { 2     private: 3         Singleton() { cout << " ...

  4. POJ3697+BFS+hash存边

    /* 疾速优化+hash存边 题意:给定一个包含N(1 ≤ N ≤ 10,000)个顶点的无向完全图,图中的顶点从1到N依次标号.从这个图中去掉M(0 ≤ M ≤ 1,000,000)条边,求最后与顶 ...

  5. hdu 4664 Triangulation 博弈论

    看到这题时,当时还不会做,也没搞懂sg函数,于是狠狠的钻研了下博弈论,渐渐的知道了sg函数…… 现在在来做这题就很容易了,1A 打表容易发现在80左右的时候就出现循环节了 代码如下: #include ...

  6. [java线段树]2015上海邀请赛 D Doom

    题意:n个数 m个询问 每个询问[l, r]的和, 再把[l, r]之间所有的数变为平方(模为9223372034707292160LL) 很明显的线段树 看到这个模(LLONG_MAX为922337 ...

  7. VC++的文件格式详解

    .APS:存放二进制资源的中间文件,VC把当前资源文件转换成二进制格式,并存放在APS文件中,以加快资源装载速度.资源辅助文件. .BMP:位图资源文件. .BSC:浏览信息文件,由浏览信息维护工具( ...

  8. LINQ语句

    http://wenku.baidu.com/link?url=hPKqDWql7DNr6W2MsINakjRYYNXmXywB_U3h9FFMeFjcToYpusI2fYKgHjZSRq7r3ULG ...

  9. 非常实用的15款开源PHP类库

    PHP库给开发者提供了一个标准接口,它帮助开发者在PHP里充分利用面向对象编程.这些库为特定类型的内置功能提供了一个标准的API,允许类可以与PHP引擎进行无缝的交互.此外,开发者使用这些类库还可以简 ...

  10. android SharedPreferences 使用

    除了SQLite数据库外,SharedPreferences也是一种轻型的数据存储方式,它的本质是基于XML文件存储key-value键值 对数据,通常用来存储一些简单的配置信息.其存储位置在/dat ...