链接: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)的更多相关文章

  1. Codeforces 785 D.Anton and School - 2(组合数处理)

    Codeforces 785 D.Anton and School - 2 题目大意:从一串由"(",")"组成的字符串中,找出有多少个子序列满足:序列长度为偶 ...

  2. Codeforces 785 E. Anton and Permutation(分块,树状数组)

    Codeforces 785 E. Anton and Permutation 题目大意:给出n,q.n代表有一个元素从1到n的数组(对应索引1~n),q表示有q个查询.每次查询给出两个数l,r,要求 ...

  3. Codeforces 785 D. Anton and School - 2

    题目链接:http://codeforces.com/contest/785/problem/D 我们可以枚举分界点,易知分界点左边和右边分别有多少个左括号和右括号,为了不计算重复我们强制要求选择分界 ...

  4. Codeforces 1138 - A/B/C/D/E - (Undone)

    链接:https://codeforces.com/contest/1137 A - Skyscrapers 题解:对于每一段 $1$ 和每一段 $2$,统计他们的长度.因此对于相邻的两段长度求较小值 ...

  5. Codeforces 677 - A/B/C/D/E - (Undone)

    链接: A - Vanya and Fence - [水] AC代码: #include<bits/stdc++.h> using namespace std; ; int n,h; in ...

  6. Codeforces 1062 - A/B/C/D/E - (Undone)

    链接:http://codeforces.com/contest/1062 A - Prank - [二分] 题意: 给出长度为 $n(1 \le n \le 100)$ 的数组 $a[1 \sim ...

  7. Codeforces 1032 - A/B/C/D/E - (Undone)

    链接:http://codeforces.com/contest/1032/ 是真的真的真的忍不住想吐槽这题意是真的真的真的读不懂…… A - Kitchen Utensils - [简单数学题] 题 ...

  8. CodeForces 785 D Anton and School - 2 范德蒙恒等式

    Anton and School - 2 题解: 枚举每个左括号作为必选的. 那么方案数就应该是下面的 1 , 然后不断化简, 通过范德蒙恒等式 , 可以将其化为一个组合数. 代码: #include ...

  9. Codeforces 1154 - A/B/C/D/E/F/G - (Undone)

    链接:https://codeforces.com/contest/1154 A - Restoring Three Numbers - [水] #include<bits/stdc++.h&g ...

随机推荐

  1. Python 入门基础15 --shutil、shelve、log常用模块2、项目结构

    今日内容: 一.常用模块 2019.04.10 更新 1.time:时间 2.calendar:日历 3.datatime:可以运算的时间 4.sys:系统 5.os:操作系统 6.os.path:系 ...

  2. php 默认保几位小数,末尾为0去掉

    计算保留几位小数,末位为0舍去 // 计算 默认保留1位小数 protected function getSprintf($value,$count,$digit = 1) { $num = 0; i ...

  3. 简单SQL注入

    既然是简单的,估计也就是''字符型把,输入'or'1 以下是输出结果,or没被过滤,单引号也没有 呢么用union联合注入试试,提交了'-1 union/**/select 1 and '1,发现回显 ...

  4. 前端 $.parseJson()

    $.parseJSON() 函数用于将符合标准格式的的JSON字符串转为与之对应的JavaScript对象. 例子: 这里首先给出JSON字符串集,字符串集如下: var data=" {  ...

  5. centos禁止与开启ping设置

    禁止ping: echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all 允许ping: echo 0 > /proc/sys/net/ipv4/i ...

  6. Lua的内存管理

    [前言] 在历史长河中,各种各样的新语言,总是伴随着我们编程人员:有的时候,工作的需要,我们不得不去学习这些很炫的,很新的语言.学习任何一门语言(我这里只说学习),都无非就是学习那么几个大模块,基本语 ...

  7. css 冷知识

    *{margin: 0;padding: 0;} li{list-style-type:none; }ul{list-style: none;}img{border: none;}ul,input,s ...

  8. Java_String&StringBuilder&StringBuffer类

    目录 一.String类 二."==" 和 "equals"的区别 三.StringBuffer和StringBuilder 一.String类 String为 ...

  9. Web Application Vulnerablities

    1. File inclusion berfoe start this caption  i make a conclusion for install third-part as follow I ...

  10. C++中几个输入函数的用法和区别(cin、cin.get()、cin.getline()、getline()、gets()、getchar())

    1.cin>> 用法1:最基本,也是最常用的用法,输入一个数字: #include <iostream>using namespace std;main (){int a,b; ...