链接:


A - Vanya and Fence - [水]

AC代码:

#include<bits/stdc++.h>
using namespace std;
const int maxn=1e3+;
int n,h;
int main()
{
cin>>n>>h;
int ans=;
for(int i=,a;i<=n;i++)
{
cin>>a;
if(a<=h) ans++;
else ans+=;
}
cout<<ans<<endl;
}

B - Vanya and Food Processor - [模拟]

应该就是https://www.cnblogs.com/dilthey/p/6804187.html我这篇远古文章中记录的这道题目的来源。

模拟的时候注意不要一秒一秒的模拟,并且注意使用long long类型,就可以了。

AC代码:

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+;
ll n,h,k,a[maxn];
int main()
{
ios::sync_with_stdio();
cin.tie(), cout.tie(); cin>>n>>h>>k;
for(int i=;i<=n;i++) cin>>a[i]; int p=;
ll t=, cnt=a[];
while(p<=n)
{
while(p+<=n && cnt+a[p+]<=h) cnt+=a[++p];
if(cnt>k) t+=cnt/k, cnt%=k;
else cnt=, t++; if(p==n && cnt==) break;
}
cout<<t<<endl;
}

C - Vanya and Label - [快速幂]

题意:给你一个 $64$ 进制的数字,让你找出所有等长的两个 $64$ 进制数对,使得他们的按位与结果和给出的这个数字相同。

题解:转成二进制观察一下,给定的数字其所有为 $0$ 的位置,对应到数对可以产生三种选择:“$0,1$”、“$1,1$”、“$1,0$”,所以就统计一下二进制下 $0$ 出现的次数,记为 $x$,求 $3^x$ 即可。

AC代码:

#include<bits/stdc++.h>
using namespace std;
typedef bitset<> B;
typedef long long ll;
const int mod=1e9+;
string s;
int num[];
void init()
{
for(char i='';i<='';i++) num[i]=i-'';
for(char i='A';i<='Z';i++) num[i]=i-'A'+;
for(char i='a';i<='z';i++) num[i]=i-'a'+;
num['-']=, num['_']=;
}
ll fpow(ll a,ll n)
{
ll res=, base=a%mod;
while(n)
{
if(n&) res*=base, res%=mod;
base*=base, base%=mod;
n>>=;
}
return res%mod;
}
int main()
{
init();
cin>>s;
ll res=;
for(int i=;i<s.size();i++) res+=6LL-((B)num[s[i]]).count();
cout<<fpow(,res)<<endl;
}

D - Vanya and Treasure- [DP+优先队列BFS]


E - Vanya and Balloons - (Undone)

Codeforces 677 - A/B/C/D/E - (Undone)的更多相关文章

  1. Codeforces 785 - A/B/C/D/E - (Undone)

    链接:https://codeforces.com/contest/785 A - Anton and Polyhedrons #include<bits/stdc++.h> using ...

  2. Codeforces 1138 - A/B/C/D/E - (Undone)

    链接:https://codeforces.com/contest/1137 A - Skyscrapers 题解:对于每一段 $1$ 和每一段 $2$,统计他们的长度.因此对于相邻的两段长度求较小值 ...

  3. Codeforces 1062 - A/B/C/D/E - (Undone)

    链接:http://codeforces.com/contest/1062 A - Prank - [二分] 题意: 给出长度为 $n(1 \le n \le 100)$ 的数组 $a[1 \sim ...

  4. Codeforces 1032 - A/B/C/D/E - (Undone)

    链接:http://codeforces.com/contest/1032/ 是真的真的真的忍不住想吐槽这题意是真的真的真的读不懂…… A - Kitchen Utensils - [简单数学题] 题 ...

  5. codeforces div2 677 D

    http://codeforces.com/problemset/problem/677/D 题目大意: 给你一个n*m的图,上面有p种钥匙(p<=n*m),每种钥匙至少有一个,期初所有为1的钥 ...

  6. Codeforces 1154 - A/B/C/D/E/F/G - (Undone)

    链接:https://codeforces.com/contest/1154 A - Restoring Three Numbers - [水] #include<bits/stdc++.h&g ...

  7. Codeforces 1114 - A/B/C/D/E/F - (Undone)

    链接:http://codeforces.com/contest/1114 A - Got Any Grapes? 题意:甲乙丙三个人吃葡萄,总共有三种葡萄:绿葡萄.紫葡萄和黑葡萄,甲乙丙三个人至少要 ...

  8. Codeforces 1043 - A/B/C/D/E/F - (Undone)

    链接:http://codeforces.com/contest/1043 A - Elections - [水水水水题] 题意: 我和另一个人竞争选举,共有 $n$ 个人投票,每个人手上有 $k$ ...

  9. Codeforces Round #677 (Div. 3) 题解

    Codeforces Round #677 (Div. 3) 题解 A. Boring Apartments 题目 题解 简单签到题,直接数,小于这个数的\(+10\). 代码 #include &l ...

随机推荐

  1. 【一步步学OpenGL 20】 -《点光源》

    教程 20 点光源 原文: http://ogldev.atspace.co.uk/www/tutorial20/tutorial20.html CSDN完整版专栏: http://blog.csdn ...

  2. PowerShell 显示气球提示框 1

    #加载 Winform 程序集,使用Out-Null抑制输出 [system.Reflection.Assembly]::LoadWithPartialName('System.Windows.For ...

  3. 【转】关于提示can't load package 'xxx.bpl.' 错误问题的解决方法

      转自: http://blog.sina.com.cn/s/blog_44fa172f0102v9x3.html         'xxx.bpl'包实际存在, 路径并且正确. 但是总提示'can ...

  4. 如何在VMware8虚拟机里安装Xp GHOST系统 解决不能启动Xp系统方法

    好久没有装系统了.之前直接在硬盘中装,装个xp(c盘内).win7(d盘内).centos(虚拟机内)三系统同在一台笔记本电脑上.走了点弯路,这次记录下在虚拟机内装ghost xp. 安装步骤: 1. ...

  5. SELECT INTO和INSERT INTO SELECT的区别 类似aaa?a=1&b=2&c=3&d=4,如何将问号以后的数据变为键值对 C# 获取一定区间的随即数 0、1两个值除随机数以外的取值方法(0、1两个值被取值的概率相等) C# MD5 加密,解密 C#中DataTable删除多条数据

    SELECT INTO和INSERT INTO SELECT的区别   数据库中的数据复制备份 SELECT INTO: 形式: SELECT value1,value2,value3 INTO Ta ...

  6. 从零开始unity特效(持续追加中)

    打算重拾3d渲染了,计划把主要理论过一遍,每部分琢磨一个言之有物的demo. 因为很多东西要现学,再加上上班-8h,更新会比较慢,但会坚持. (待续) -------houdini+unity河流(2 ...

  7. 【转】WPF 与 WinForm 间的按键值(枚举)转换

    There is a function for that in System.Windows.Input.KeyInterop static class. Try:var inputKey = Key ...

  8. JS 日期补0

    js日期需要yyyy-mm-dd的时候只显示yyyy-m-d,需要前面补充0,之前都是用的判断,感觉非常low.刚刚看到一个方法padStart用了用还不错,padStart是为数值补全指定位数,对应 ...

  9. android6.0 Activity(四) Surface创建

     原文:http://blog.csdn.net/luoshengyang/article/details/8303098.原文代码比較老了,可是核心不变.在原文基础上改动了一些代码,以及增加自己 ...

  10. Halcon 彩色图片通道分割处理

    1.RGB通道:R红色,G绿色,B蓝色:R.G.B各占一个字节,取值范围在0—255:可代表的颜色数256*256*256==2^24 黑色区域是:R=G=B=0;   白色区域是:R=G=B=255 ...