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 ...
随机推荐
- Java 计算两个日期相差月数、天数
package com.myjava; import java.text.ParseException; import java.text.SimpleDateFormat; import java. ...
- Django的Admin站点管理
一.概述 内容发布:负责添加.修改.删除内容 公告访问 二.配置Admin应用 在settings.py文件中的INSTALLED_APPS中添加'django.contrib.admin',默认是添 ...
- 使用HBuilder+MUI+Flask后端服务器框架+Mongodb数据库开发手机APP
1.开发准备HBuilder: 1.下载安装HBuilder2.创建APP项目 3.代码示例: <!doctype html> <html lang="en"&g ...
- dubbo服务运行的三种方式
dubbo服务运行,也就是让生产服务的进程一直启动.如果生产者进程挂掉,也就不存在生产者,消费者不能进行消费. Dubbo服务运行的三种方式如下:1.使用Servlet容器运行(Tomcat.Jett ...
- JAVA中几种常用的RPC框架介绍
原文:https://blog.csdn.net/zhaowen25/article/details/45443951
- [Linux]ln -al输出内容解析
第一项的第一位是文件类型:-: 表示普通文件d: 目录b: 块特殊文件c: 字符特殊文件l: 符号链接文件p: 命名管道文件FIFOs: 套接字文件 第二项是该文件的inode的链接计数,即stat ...
- alembic使用
前言 alembic是SQLAlchemy作者编写的控制 model 版本的模块,配合SQLAlchemy使用更佳 正文 安装 pip install alembic alembic是可以在DOS中执 ...
- Python 爬虫 NewCnblogs (爬虫-Django-数据分析)
需求分析 数据库架构 注册 登录 首页 个人站点 文章+评论 后台 爬虫 数据分析 添加搜索+已上线
- 使用Jmeter监测服务器性能指标
jmeter监控服务器CPU.内存等性能参数,需要安装一些插件 插件名:JMeterPlugins-Extras,JMeterPlugins-Standard 以及ServerAgent. 下载地址: ...
- 别再用"while (!feof(file))"来逐行读取txt文件了!
起因 执行一个C/C++程序出现segment fault.它逐行读取文本文件,每一行是一个图片名字,然后读图.处理图像,etc. 发现最后一次读取的文件名不存在(空的). 正确的逐行读取txt文件 ...