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 ...
随机推荐
- 黑马vue---19、v-for中key的使用注意事项
黑马vue---19.v-for中key的使用注意事项 一.总结 一句话总结: 必须 在使用 v-for 的同时,指定 唯一的 字符串/数字 类型 :key 值 <p v-for="i ...
- 谷歌guava缓存
简易缓存,可以设置时间的缓存 private static Cache<String,String> tokenCache = CacheBuilder.newBuilder().expi ...
- React Native初始化项目0.47.1报错
首先看一下安卓和iOS报错: iOS终端运行报错: Xcode运行报错: 解决办法一: 将版本降到0.44.3,修改package,具体请看我的另一篇博客: http://www.cnblogs.co ...
- JavaWeb—Nginx介绍(转载)
Nginx的产生 没有听过Nginx?那么一定听过它的"同行"Apache吧!Nginx同Apache一样都是一种WEB服务器.基于REST架构风格,以统一资源描述符(Unifor ...
- 二、windows下搭建vue开发环境+IIS部署
有时我们的服务器并不一定是node,也许是IIS,这样我们就需要把工程构建出来,与IIS集成. 构建该项目的命令如下 cnpm run build 将dist文件夹拷贝出来,放到IIS的发布目录,在浏 ...
- cmake 在mac系统的安装
CMake是一个比make更高级的跨平台的安装.编译.配置工具,可以用简单的语句来描述所有平台的安装(编译过程).并根据不同平台.不同的编译器,生成相应的Makefile或者project文件.本文主 ...
- [SOME_MUTATION] (state) {// mutate state}Vuex中使用 ES2015 风格的计算属性命名功能来使用一个常量作为函数名
使用常量替代 Mutation 事件类型 使用常量替代 mutation 事件类型在各种 Flux 实现中是很常见的模式.这样可以使 linter 之类的工具发挥作用,同时把这些常量放在单独的文件中可 ...
- Web后台管理系统
开发语言:C# 数据库:sql2008 登录页面 后台管理首页 部分操作页面 后台管理系统,界面简洁,大方,操作简单,所有功能可定制开发. 后台管理系统制作 如果您有需要后台管理系统制作,请扫描添加微 ...
- 【miscellaneous】IP多播技术及其编程
标 题: IP多播技术及其编程 发信站: 幽幽黄桷兰 (Mon Jun 16 10:35:39 2003) 转信站: SMTH!maily.cic.tsinghua.edu.cn!news2.ues ...
- 【图像处理】DVR H.264视频编码基本知识
视频编码技术基本是由ISO/IEC制定的MPEG-x和ITU-T制定的H.26x两大系列视频编码国际标准的推出.从H.261视频编码建议,到 H.262/3.MPEG-1/2/4等都有一个共同的不断追 ...