链接:


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. gdb调试常用实用命令和core dump文件的生成(转)

    1.生成core dump文件的方法: $  ulimit -c //查看是否为0 如果为0 $   ulimit -c unlimited 这样在程序崩溃以后会在当前目录生成一个core.xxxx的 ...

  2. mysql百分比显示

    select doll_name, type, value concat( left(get /(get+ fall)*100, 5), '%') as 抓取概率 from doll_conf

  3. Nginx——location常见配置指令,alias、root、proxy_pass

    1.[alias] 别名配置,用于访问文件系统,在匹配到location配置的URL路径后,指向[alias]配置的路径.如: location /test/ { alias /home/sftp/i ...

  4. spring boot 搭建

    http://www.ityouknow.com/springboot/2018/06/12/spring-boo-java-simple.html 在http://start.spring.io/下 ...

  5. redis应用-sortedset实现排行榜(转载)

    package site.zy9.redisApp.test; import java.util.HashMap; import java.util.List; import java.util.Ma ...

  6. 转 Java虚拟机5:Java垃圾回收(GC)机制详解

    转 Java虚拟机5:Java垃圾回收(GC)机制详解 Java虚拟机5:Java垃圾回收(GC)机制详解 哪些内存需要回收? 哪些内存需要回收是垃圾回收机制第一个要考虑的问题,所谓“要回收的垃圾”无 ...

  7. 爬虫对自己服务器 CPU,内存和网速的影响

    今天无事写一遍关于爬虫对计算机的影响,主要是给小白同学普及一下爬虫的基础知识. 在我们写爬虫的时候,首先会想到开多线程,如果使用的语言是Python,很不幸,因为Python存在  GIL,在任何时候 ...

  8. Xcode No account for team "". Add a new account in the Accounts preference pane or verify that your accounts have valid credentials.

    问题背景 Xcode报错误信息:No account for team "QMP96B5DPW". Add a new account in the Accounts prefer ...

  9. [转]kindeditor隐藏上传图片框网络图片或本地上传的功能

    原文地址:http://www.lingchenliang.com/post/154.html kindeditor富文本编辑器点击上传图片按钮,在弹出的窗口中去掉上传网络图片的功能,只留下本地上传, ...

  10. [Java并发编程(四)] Java volatile 的理论实践

    [Java并发编程(四)] Java volatile 的理论实践 摘要 Java 语言中的 volatile 变量可以被看作是一种 "程度较轻的 synchronized":与 ...