链接:
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 ...
随机推荐
-
WebForm控件Repeater
我们会发现用拼接字符串来显示一个查询非常的麻烦,有一个控件Repeater帮助你,省去写Foreach LinQ to SQL类 函数类: using System; using System.Col ...
-
yii2添加自定义字段
在模型model文件中,添加 public $attributes;即可,$attributes 为要添加的新字段
-
【20160924】GOCVHelper MFC增强算法(3)
//获得当前目录路径 static CString GetLocalPath(){ CString csCfgFilePath; GetModuleFi ...
-
[Java] 关键字final、static使用总结
一.final 根据程序上下文环境,Java关键字final有“这是无法改变的”或者“终态的”含义,它可以修饰非抽象类.非抽象类成员方法和变量.你可能出于两种理解而需要阻止改变:设计或效率.final ...
-
ES6:JavaScript 新特性
我相信,在ECMAScript.next到来的时候,我们现在每天都在写的JavaScript代码将会发生巨大的变化.接下来的一年将会是令JavaScript开发者们兴奋的一年,越来越多的特性提案将被最 ...
-
hbase性能调优之压缩测试
文章概述: 1.顺序写 2.顺序读 3.随机写 4.随机读 5.SCAN数据 0 性能测试工具 hbase org.apache.hadoop.hbase.PerformanceEvaluation ...
-
Android全局异常处理 实现自己定义做强制退出和carsh日志抓取
在做android项目开发时,大家都知道都会遇到程序报错或者Anr异常,会弹出来一个强制退出的弹出框,对于开发人员是好事,但是对于用户体验和 UI实在毫无违和感,别说用户接受不了,就连我们自己本身可能 ...
-
【原创】Git删除暂存区或版本库中的文件
0 基础 我们知道Git有三大区(工作区.暂存区.版本库)以及几个状态(untracked.unstaged.uncommited),下面只是简述下Git的大概工作流程,详细的可以参见本博客的 ...
-
MyBatis + MySQL返回插入成功后的主键id
这是最近在实现perfect-ssm中的一个功能时碰到的一个小问题,觉得需要记录一下,向MySQL数据库中插入一条记录后,需要获取此条记录的id值,以生成对应的key值存入到redis中,id为自增i ...
-
JSON for-in 遍历
(代码均以js代码示例) 1.可以使用 for-in 来循环对象的属性,使用中括号([])来访问属性的值: 这中方法便于一些在不确定有属性的情况下使用. var myObj = { "nam ...