Codeforces 677 - A/B/C/D/E - (Undone)
链接:
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)的更多相关文章
- Codeforces 785 - A/B/C/D/E - (Undone)
链接:https://codeforces.com/contest/785 A - Anton and Polyhedrons #include<bits/stdc++.h> using ...
- Codeforces 1138 - A/B/C/D/E - (Undone)
链接:https://codeforces.com/contest/1137 A - Skyscrapers 题解:对于每一段 $1$ 和每一段 $2$,统计他们的长度.因此对于相邻的两段长度求较小值 ...
- Codeforces 1062 - A/B/C/D/E - (Undone)
链接:http://codeforces.com/contest/1062 A - Prank - [二分] 题意: 给出长度为 $n(1 \le n \le 100)$ 的数组 $a[1 \sim ...
- Codeforces 1032 - A/B/C/D/E - (Undone)
链接:http://codeforces.com/contest/1032/ 是真的真的真的忍不住想吐槽这题意是真的真的真的读不懂…… A - Kitchen Utensils - [简单数学题] 题 ...
- codeforces div2 677 D
http://codeforces.com/problemset/problem/677/D 题目大意: 给你一个n*m的图,上面有p种钥匙(p<=n*m),每种钥匙至少有一个,期初所有为1的钥 ...
- Codeforces 1154 - A/B/C/D/E/F/G - (Undone)
链接:https://codeforces.com/contest/1154 A - Restoring Three Numbers - [水] #include<bits/stdc++.h&g ...
- Codeforces 1114 - A/B/C/D/E/F - (Undone)
链接:http://codeforces.com/contest/1114 A - Got Any Grapes? 题意:甲乙丙三个人吃葡萄,总共有三种葡萄:绿葡萄.紫葡萄和黑葡萄,甲乙丙三个人至少要 ...
- Codeforces 1043 - A/B/C/D/E/F - (Undone)
链接:http://codeforces.com/contest/1043 A - Elections - [水水水水题] 题意: 我和另一个人竞争选举,共有 $n$ 个人投票,每个人手上有 $k$ ...
- Codeforces Round #677 (Div. 3) 题解
Codeforces Round #677 (Div. 3) 题解 A. Boring Apartments 题目 题解 简单签到题,直接数,小于这个数的\(+10\). 代码 #include &l ...
随机推荐
- 全栈JavaScript之路(十九)HTML5 插入 html标记 ( 一 )innerHTML 与outerHTML
在须要给文档插入大量的html 标记下.通过DOM操作非常麻烦,你不仅要创建一系列的节点,并且还要小心地依照顺序把它们接结起来. 利用html 标签 插入技术,能够直接插入html代码字符串,简单.高 ...
- fgrep: ifcfg-ifcfg-eth0: No such file or directory
[root@localhost ~]# service network restartfgrep: ifcfg-ifcfg-eth0: No such file or directoryfgrep: ...
- MySQL 服务常用操作命令
1.MySQL 服务设置 在使用 mysql.server 命令之前需要将路径 /usr/local/mysql/support-files 添加到系统环境变量中. export PATH=$PATH ...
- NetCore指令集和
1.查看当前目录的版本号 C:\Users\Administrator>dotnet --version 1.0.4 2.发布程式,进入到指定目录 dotnet publish 3.运行程式 # ...
- Atitit 如何在水泥森林打猎 找到合适的公司
Atitit 如何在水泥森林打猎 找到合适的公司 1. 我们工作的本质就是打猎,万年前在草原森林里面打猎,现在在水泥森林里面打猎 2 1.1. 我们的本质职位只有一个,那就是猎人 2 1.2. 所有 ...
- 原创:在局域网中,如何知道某个IP被占用 show arp
如果某一栋楼有三层交换机(一般为汇聚层交换机),只需要在该三层交换机输入命令:show arp,即可知道当前那些IP地址被占用.如果该栋楼只有二层交换机(接入层交换机),需要在连接该二层交换机的上级三 ...
- .net IIS MVC Rest api 跨域 PUT DELETE 404 无法使用问题解决方案
一.WebConfig配置法(system.webServer 重点是 httpProtocol handlers) http://www.jinxuliang.com/blog/article/re ...
- Manual Validation with Data Annotations C#对实体类进行手动验证
Several people have asked me about using data annotations for validation outside of a UI framework, ...
- SQLSERVER查询那个表里有数据
declare @table table (rows int,tablename nvarchar(100));declare @sql NVARCHAR(MAX)declare @rows int; ...
- Android实现夜间模式
如今非常多App都有夜间模式,特别是阅读类的App.夜间模式如今已经是阅读类App的标配了,其实,日间模式与夜间模式就是给App定义并应用两套不同颜色的主题,用户能够自己主动或者手动的开启,今天用An ...