Codeforces 785 - A/B/C/D/E - (Undone)
链接:https://codeforces.com/contest/785
A - Anton and Polyhedrons
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+;
map<string,int> mp;
int n,sum;
string str;
int main()
{
ios::sync_with_stdio();
cin.tie(), cout.tie(); mp.clear();
mp["Tetrahedron"]=;
mp["Cube"]=;
mp["Octahedron"]=;
mp["Dodecahedron"]=;
mp["Icosahedron"]=; cin>>n, sum=;
while(n--) cin>>str, sum+=mp[str];
cout<<sum<<endl;
}
B - Anton and Classes
#include<bits/stdc++.h>
#define pb(x) push_back(x)
using namespace std;
typedef pair<int,int> P;
#define fi first
#define se second
#define mk(x,y) make_pair(x,y)
const int MAX=2e5+; int n,m,x,y;
vector<P> A;
P L,R; int main()
{
ios::sync_with_stdio();
cin.tie(), cout.tie(); cin>>n;
while(n--)
{
cin>>x>>y;
A.pb(mk(x,y));
} cin>>m;
L=mk(,(int)2e9), R=mk(,);
while(m--)
{
cin>>x>>y;
if(y<L.se) L=mk(x,y);
if(x>R.fi) R=mk(x,y);
}
// cout<<L.fi<<" "<<L.se<<endl;
// cout<<R.fi<<" "<<R.se<<endl; int res=;
for(auto x:A)
{
int now=;
if(x.fi>L.se) now=max(now,x.fi-L.se);
if(x.se<R.fi) now=max(now,R.fi-x.se);
res=max(res,now);
}
cout<<res<<endl;
}
C - Anton and Fairy Tale - [算术题]
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; ll n,m; int main()
{
cin>>n>>m;
if(n<=m) cout<<n<<endl;
else
{
ll k=sqrt(*(n-m));
while(k*(k+)/<n-m) k++;
cout<<m+k<<endl;
}
}
D - Anton and School - 2 - [范德蒙德恒等式][快速幂+逆元]
Codeforces 785 - A/B/C/D/E - (Undone)的更多相关文章
- Codeforces 785 D.Anton and School - 2(组合数处理)
Codeforces 785 D.Anton and School - 2 题目大意:从一串由"(",")"组成的字符串中,找出有多少个子序列满足:序列长度为偶 ...
- Codeforces 785 E. Anton and Permutation(分块,树状数组)
Codeforces 785 E. Anton and Permutation 题目大意:给出n,q.n代表有一个元素从1到n的数组(对应索引1~n),q表示有q个查询.每次查询给出两个数l,r,要求 ...
- Codeforces 785 D. Anton and School - 2
题目链接:http://codeforces.com/contest/785/problem/D 我们可以枚举分界点,易知分界点左边和右边分别有多少个左括号和右括号,为了不计算重复我们强制要求选择分界 ...
- Codeforces 1138 - A/B/C/D/E - (Undone)
链接:https://codeforces.com/contest/1137 A - Skyscrapers 题解:对于每一段 $1$ 和每一段 $2$,统计他们的长度.因此对于相邻的两段长度求较小值 ...
- Codeforces 677 - A/B/C/D/E - (Undone)
链接: A - Vanya and Fence - [水] AC代码: #include<bits/stdc++.h> using namespace std; ; int n,h; in ...
- 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 785 D Anton and School - 2 范德蒙恒等式
Anton and School - 2 题解: 枚举每个左括号作为必选的. 那么方案数就应该是下面的 1 , 然后不断化简, 通过范德蒙恒等式 , 可以将其化为一个组合数. 代码: #include ...
- Codeforces 1154 - A/B/C/D/E/F/G - (Undone)
链接:https://codeforces.com/contest/1154 A - Restoring Three Numbers - [水] #include<bits/stdc++.h&g ...
随机推荐
- Spring系列(零) Spring Framework 文档中文翻译
Spring 框架文档(核心篇1和2) Version 5.1.3.RELEASE 最新的, 更新的笔记, 支持的版本和其他主题,独立的发布版本等, 是在Github Wiki 项目维护的. 总览 历 ...
- 解决ajax跨域的办法,代理,cors,jsonp
1.使用php做代理去请求第三方api接口 php是可以跨域的,我们利用ajax请求本域名中的php文件,php再去请求第三方接口文件,从而达到跨域目的. php做代理请求: ajax请求本域名php ...
- iis7 设置自定义404页面无效解决方案
想给自己做的的网站自定义一个404页面,开始 双击红框提示的错误页图标 双击上图红框提示的所示404行 修改上图红框提示的内容如下:我是直接在根目录放了一个自己做的404.html,实际情况要填写你自 ...
- Everything工具使用
一.简介 Everything : Windows下的文件名搜索引擎 二.Everything工具下载 官方最新版本下载 Everything下载 三.Everything快捷搜索 Java*.doc ...
- Python中的 @staticmethod@classmethod方法
python类中有三种方法,常见的是实例方法,另外两种是staticmethod装饰的静态方法,和classmethod装饰的类方法. 1.对比 流畅的python里,用一个例子进行了对比: (1)两 ...
- Python学习笔记七
面向对象编程 面向对象的特性如下: 类:具有相同属性和方法的一类事物,成为类. 对象:类的实例化后的结果,一个类可以实例化多个对象,每个对象也可以不同的属性. 封装:在类中对数据的赋值,类里面包含着类 ...
- jQuery的选择器中的通配符[id^='code']或[name^='code']及jquery选择器总结
1.选择器 (1)通配符: $("input[id^='code']");//id属性以code开始的所有input标签 $("input[id$='code']&quo ...
- Knockout案例: 全选
- yii2的csrf验证原理分析及token缓存解决方案
本文主要分三个部分,首先简单介绍csrf,接着对照源码重点分析一下yii框架的验证原理,最后针对页面缓存导致的token被缓存提出一种可行的方案.涉及的知识点会作为附录附于文末. 1.CSRF描述 C ...
- 关于linux上部署定时python脚本
遇到的坑: Python脚本中的文件操作,最好都用绝对路径, 文件头上写 #!/usr/local/bin/python3.6 ----------------------------------- ...