Atcoder-SoundHound Inc.Contest 2018 -Masters Tournament-比赛报告
A
C++ Example
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cctype>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
if(a+b==15)puts("+");
else if(a*b==15)puts("*");
else puts("x");
return 0;
}
B
C++ Example
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cctype>
using namespace std;
const int maxn=100000;
char str[maxn];
int main(){
int w;
scanf("%s",str);
scanf("%d",&w);
if(w==1){printf("%s",str);return 0;}
for(int i=0;i<strlen(str);i++){
if(i%w==0){
putchar(str[i]);
}
}
return 0;
}
C
这题画风突变啊喂
这题我比较SB打表没找出规律还是yjw学长点醒了我 \(yjw\)学长 \(orz\)
这题其实是个概率题,长度为\(m\),则最多有\(m-1\)对数字,显然每一对之间是互相不影响的,于是我们先来研究一对数字的情况:
首先每个数字都有n个数字与之配对,总计\(n × n\)种情况,再考虑对答案做贡献的,假设那一对数字是\(x,y (y>x)\),则能做贡献的情况有\(n-d\)种.当然我们这只是\(x<y\)的情况,所以共\(2×(n-d)\)种。当然\(d==0\)时,就无关大小,只有\((n-d)\)种,这需要特判.
然后交上去还是\(WA\)了,发现强制类型转换写在括号外导致会爆\(int\),比较坑
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <cmath>
#define ri register int
using namespace std;
template <class T>void read(T &x){
x=0;int ne=0;char c;
while(!isdigit(c=getchar()))ne=c=='-';
x=c-48;
while(isdigit(c=getchar()))x=(x<<3)+(x<<1)+c-48;
x=ne?-x:x;
return ;
}
int n,m,d;
int main(){
read(n),read(m),read(d);
if(d==0)printf("%.10Lf\n",(long double)(m-1)/n);
else if(n<=d)printf("0.0000000\n");
else printf("%.10Lf\n",(long double)(1.00*2*(n-d)*(m-1))/n/n);
return 0;
}
D
这题解法很有意思,比较考验智商
求两个最短路,一个是\(s\)到\(x (x \in [1,n])\)的用\(yen\)衡量的最短路\(dis_1(s,x)\),一个是从\(t\)到\(x (x \in [1,n])\)的最短路\(dis_2(t,x)\),用\(snuuk\)衡量的最短路
然后我们想,最后\(n-1\)年出发的时候只用\(n\)这个点可以交换货币,所以\(val[n-1]=dis_1(s,n)+dis_2(t,n)\)
再向下想,在\(n-2\)年出发时,要么继续到\(n\)这个点交换货币,要么到\(n-1\)这个点交换货币,以此类推得到
\(val[p]=min(val[p+1],dis_1(s,p)+dis_2(t,p)) p \in [0,n-1]\)
最后初始钱数\(-val\)值就是对应答案
E
我太菜不知道怎么做,等待咕咕咕的题解吧
Atcoder-SoundHound Inc.Contest 2018 -Masters Tournament-比赛报告的更多相关文章
- AtCoder SoundHound Inc. Programming Contest 2018 E + Graph (soundhound2018_summer_qual_e)
原文链接https://www.cnblogs.com/zhouzhendong/p/AtCoder-SoundHound-Inc-Programming-Contest-2018-E.html 题目 ...
- ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syria, Lattakia, Tishreen University, April, 30, 2018
ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syr ...
- German Collegiate Programming Contest 2018 B. Battle Royale
Battle Royale games are the current trend in video games and Gamers Concealed Punching Circles (GCPC ...
- The North American Invitational Programming Contest 2018 D. Missing Gnomes
A family of nn gnomes likes to line up for a group picture. Each gnome can be uniquely identified by ...
- The North American Invitational Programming Contest 2018 H. Recovery
Consider an n \times mn×m matrix of ones and zeros. For example, this 4 \times 44×4: \displaystyle \ ...
- The North American Invitational Programming Contest 2018 E. Prefix Free Code
Consider nn initial strings of lower case letters, where no initial string is a prefix of any other ...
- [AtCoder] NIKKEI Programming Contest 2019 (暂缺F)
[AtCoder] NIKKEI Programming Contest 2019 本来看见这一场的排名的画风比较正常就来补一下题,但是完全没有发现后两题的AC人数远少于我补的上一份AtCoder ...
- [AtCoder] Yahoo Programming Contest 2019
[AtCoder] Yahoo Programming Contest 2019 很遗憾错过了一场 AtCoder .听说这场是涨分场呢,于是特意来补一下题. A - Anti-Adjacency ...
- ACM-ICPC Asia Beijing Regional Contest 2018 Reproduction hihocoder1870~1879
ACM-ICPC Asia Beijing Regional Contest 2018 Reproduction hihocoder1870~1879 A 签到,dfs 或者 floyd 都行. #i ...
随机推荐
- fastadmin编辑内容,有下拉选择关联的内容,自定义的参数去获取相应的下拉内容
1.可以到你的编辑页面中添加自定义条件 data-params='{"custom[shop_id]":"2"}'
- Flume-概述
Flume 是 Cloudera 提供的一个高可用的,高可靠的,分布式的海量日志采集.聚合和传输的系统.Flume 基于流式架构,灵活简单. Flume最主要的作用就是,实时读取服务器本地磁盘的数据, ...
- ubuntu下如何使用dpkg删除某个软件包?
答:步骤如下: 1. 找出包名 dpkg -l |grep <package name> 2. 卸载 dpkg -r <package name>
- 反射中的 Method 的 getReadMethod 与 getWriteMethod 使用 【获取一个对象的所有属性字段名称和其对应的值】
转: class反射(一),以及Method 的 getReadMethod 与 getWriteMethod 使用 2018年11月28日 17:27:42 zich77521 阅读数 788 ...
- nova创建虚拟机的详细过程
Nova 创建虚拟机详细过程
- GBK格式字符串右补空格
public class Test2 { public static void main(String[] s) throws IOException { List<User> l ...
- 20190903 - CSDN 的奇葩替换
可能是出于安全原因 CSDN 对内容中的代码,作了很多奇葩的替换. 比如下面两行,是否有差别? # - # -16 有.其实 cut 后的短横线,内部编码不同,前者复制后无法被识别. 再比如下面两个词 ...
- 解读GitHub EntityComponentSystemSamples
出自Unity官方的ECS项目示例,该项目的第一次Commit是在2018年3月20号,距离现在一年半的时间,这期间ECS本身的生态在快速发展,稳定性也是逐步提升,期待在2020年的Unity版本中作 ...
- 【C/C++开发】【Java开发】JNI的替代者—使用JNA访问Java外部功能接口
JNI的替代者-使用JNA访问Java外部功能接口 1. JNA简单介绍 先说JNI(Java Native Interface)吧,有过不同语言间通信经历的一般都知道,它允许Java代码和其他语言( ...
- 论文阅读及复现 | Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks
两种形式的LSTM变体 Child-Sum Tree-LSTMs N-ary Tree-LSTMs https://paperswithcode.com/paper/improved-semantic ...