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 ...
随机推荐
- POJ 2488 -- A Knight's Journey(骑士游历)
POJ 2488 -- A Knight's Journey(骑士游历) 题意: 给出一个国际棋盘的大小,判断马能否不重复的走过所有格,并记录下其中按字典序排列的第一种路径. 经典的“骑士游历”问题 ...
- 前端知识点回顾——Javascript篇(一)
DOM特殊元素获取 document.documentElement //HTML标签 document.head //head标签 document.title //title标签 document ...
- jQuery九类选择器
目的:通过选择器,能定位web页面(HTML/JSP/XML)中的任何标签, 注意:项目中,通常是多种选择器一起使用 基本选择器 <html> <head> <meta ...
- UI布局属性大全
第一类:属性值为true或false android:layout_centerHrizontal 水平居中 android:layout_centerVertical 垂直居中 android:la ...
- [CDH] Acquire data: Flume and Kafka
Flume 基本概念 一.是什么 Ref: http://flume.apache.org/ 数据源获取:Flume.Google Refine.Needlebase.ScraperWiki.Bloo ...
- PO BAPI "BAPI_PO_CREATE1"
DATA: poheader LIKE bapimepoheader, poheaderx LIKE bapimepoheaderx, poitem LIKE ...
- Python3 循环_break和continue语句及循环中的else子句
break和continue语句及循环中的else子句break语句可以跳出for和while的循环体.如果你从for或while循环中终止,任何对应的循环else块将不执行. continue语句被 ...
- Swift3.0封装 AFN 的 GET&POST网络请求
// // PSNetWorkManage.swift // WeiBoSwift // // Created by 思 彭 on 16/9/25. // Copyright © 2016年 思 彭. ...
- playbook文件内容解释
[root@node1 playbook]# cat nginx.yml - hosts: test \\主机组,要和nginx.yml在同一个目录下 remote_user: root \\远端执行 ...
- Spring Cloud(4):断路器(Hystrix)
Hystrix介绍 相对于单一系统,分布式系统更容易遇到故障,所以我们一般通过构建冗余,使用集群和负载均衡来保证系统的弹性和高可用.当然,这种方式只解决了一部分问题,当服务崩溃时,我们很容易检测到,因 ...