2018 JUST Programming Contest 1.0 题解】的更多相关文章

题目链接  gym101778 Problem A 转化成绝对值之后算一下概率.这个题有点像 2018 ZOJ Monthly March Problem D ? 不过那个题要难一些~ #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i(a); i <= (b); ++i) #define dec(i, a, b) for (int i(a); i >= (b); --i) #d…
[题目链接] A - On The Way to Lucky Plaza 首先,$n>m$或$k>m$或$k>n$就无解. 设$p = \frac{A}{B}$,$ans = C_{n - 1}^{k - 1}{\left( {\frac{A}{B}} \right)^{k}}{\left( {\frac{B-A}{B}} \right)^{n - k}} = \frac{{\left( {n - 1} \right)! \times {A^k} \times {{\left( {B -…
2018 AICCSA Programming Contest A Tree Game B Rectangles 思路:如果存在大于0的交面积的话, 那么肯定能找到一条水平的直线 和 一条垂直的直线, 使得水平直线的左右两边点的个数相等且为n, 垂直直线的左右两边点的个数相等且为n 也就是说不能有点在这两条线上, 否则交面积为0 然后左上角的点和右下角的点配对, 左下角的点和右上角的点配对 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #…
Programming Contest Ranking . 题目描述 Heilongjiang Programming Contest will end successfully! And your task is programming contest ranking. The following rules rankings: 1. A problem is solved when it is accepted by the judges. 2. Teams are ranked accor…
A.On The Way to Lucky Plaza  (数论)题意:m个店 每个店可以买一个小球的概率为p       求恰好在第m个店买到k个小球的概率 题解:求在前m-1个店买k-1个球再*p就好了 最开始没太懂输出什么意思       其实就是p*q的逆元的意思 因为概率是三位小数于是对他*1000*1000的逆元处理 还要加个eps 因为0.005浮点数由于不确定性可能存的0.0050001或者0.00499999 #include <bits/stdc++.h> using na…
Problem F. Grab The Tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 2004    Accepted Submission(s): 911 Problem Description Little Q and Little T are playing a game on a tree. There are …
Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1770    Accepted Submission(s): 1089 Problem Description Alice and Bob are playing a game. The game is played on a set of positive integers…
Maximum Multiple Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3985    Accepted Submission(s): 926 Problem Description Given an integer n, Chiaki would like to find three positive integers x,…
题目链接:http://codeforces.com/gym/101147 2017/8/27日训练赛,题目情况9/11,Rank 4/79. A. The game of Osho 题意:定义一个子游戏,B,N可以从N减掉B^k要求B^k小于等于N,当N变成0,该哪个人选,哪个人就输了,给出G个这样的游戏,问最后的输赢情况. 解法:组合游戏,SG打表发现规律,然后求Nim和判断即可. #include <bits/stdc++.h> using namespace std; typedef…
Solved A HDU 6298 Maximum Multiple Solved B HDU 6299 Balanced Sequence Solved C HDU 6300 Triangle Partition Solved D HDU 6301 Distinct Values   E HDU 6302 Maximum Weighted Matching   F HDU 6303 Period Sequence Solved G HDU 6304 Chiaki Sequence Revisi…
A-C 直接放代码吧. A int n,k; int main() { n=read();k=read(); puts(k<=(n+1)/2?"YES":"NO"); return 0; } B int d[N];pair<int,int>s[10]; int main() { for(int i=1,u,v;i<=3;i++){ u=read();v=read(); s[i].first=u;s[i].second=v; d[u]++;d[…
台州学院ICPC赛前训练5 人生第一次ak,而且ak得还蛮快的,感谢队友带我飞 A 直接用claris的模板啊,他模板确实比较强大,其实就是因为更新的很快 #include<bits/stdc++.h> using namespace std; int fun(int x,int y) { return x&y; } ; int n,a[N],l[N],v[N]; int main() { ios::sync_with_stdio(),cin.tie(),cout.tie(); int…
B. Linear Algebra Test time limit per test 3.0 s memory limit per test 256 MB input standard input output standard output Dr. Wail is preparing for today's test in linear algebra course. The test's subject is Matrices Multiplication. Dr. Wail has n m…
I. Move Between Numbers time limit per test 2.0 s memory limit per test 256 MB input standard input output standard output You are given n magical numbers a1, a2, ..., an, such that the length of each of these numbers is 20 digits. You can move from…
D. Dice Game time limit per test 1.0 s memory limit per test 256 MB input standard input output standard output A dice is a small cube, with each side having a different number of spots on it, ranging from 1 to 6. Each side in the dice has 4 adjacent…
H. Eyad and Math time limit per test 2.0 s memory limit per test 256 MB input standard input output standard output Eyad was given a simple math problem, but since he is very bad at math he asked you to help him. Given 4 numbers, a, b, c, and d. Your…
K. Malek and Summer Semester time limit per test 1.0 s memory limit per test 256 MB input standard input output standard output Malek registered n courses for the summer semester. Malek has a success rate m, which means he has to succeed at least in …
E. The Architect Omar time limit per test 1.0 s memory limit per test 256 MB input standard input output standard output Architect Omar is responsible for furnishing the new apartments after completion of its construction. Omar has a set of living ro…
B. So You Think You Can Count? 设dp[i]表示以i为结尾的方案数,每个位置最多往前扫10位 #include<bits/stdc++.h> using namespace std; typedef long long ll; ; ; ll dp[maxn];//dp[i]表示以i结尾的方案数. ]; char s[maxn]; int main() { int n; cin >> n; cin >> s + ; dp[] = ; ;i &…
题目大意 你有一条区间\([0, X)\),并且有一个数组\(L_1, ..., L_n\).对于任意\(1 \leq i \leq n\),你可以指定一个非负整数\(0 \leq j_i \leq X - L_i\).求有多少种指定的方法,使得\([j_1, j_1 + L_1), [j_2, j_2 + L_2), ..., [j_n, j_n + L_n)\)能覆盖\([0, X)\)这段区间,输出这个方案数模\(1000000007\)的最小非负剩余. 约束条件 \(1 \leq N \…
ZOJ 4024 Peak 题意 给出n和n个数,判断该数列是否是凸形的. 解题思路 从前往后第一对逆序数,和从后往前第一队逆序数,如果都非零而且相邻,证明该数组是凸形的. 代码 #include <cstdio> + ; int a[maxn]; int main() { int T; scanf("%d", &T); while(T--) { int n; scanf("%d", &n); ; i < n; i++) { sca…
原文链接https://www.cnblogs.com/zhouzhendong/p/AtCoder-SoundHound-Inc-Programming-Contest-2018-E.html 题目传送门 - AtCoder SoundHound Inc. Programming Contest 2018 E 题意 给定一个无向连通图,有 $n$ 个节点 $m$ 条带权边,第 $i$ 条边连接 $x_i,y_i$ ,权值为 $s_i$ ,没有重边.自环. 现在,请你给每一个节点取一个正整数点权…
layout: post title: 2018-2019 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2018) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces 传送门 付队! B.Baby Bites (签到模拟) 按照题意模拟就行了 int a[maxn]; string s; int main() { std::ios::syn…
layout: post title: 2018 German Collegiate Programming Contest (GCPC 18) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces 传送门 付队博客 C.Coolest Ski Route (记忆化搜索) 题意 给出一个有向图,求出一个权值最长的链, 题解 暴力dfs会超时,所以直接储存每个起点能走到的最远距离 #include<…
摘要 本文主要给出了2018 ACM-ICPC Asia Beijing Regional Contest的部分题解,意即熟悉区域赛题型,保持比赛感觉. Jin Yong’s Wukong Ranking List 题意 输入关系组数n和n组关系,每组关系是s1 > s2,问第一出现矛盾的组,或者没有矛盾就输出0. 解题思路 第一感觉是拓扑排序,未完,又写了一个深搜的传递闭包,1 A,和2018年河南省赛的题很像. 代码 #include <cstdio> #include <ma…
2018 ACM-ICPC, Syrian Collegiate Programming Contest A Hello SCPC 2018! 水题 B Binary Hamming 水题 C Portals 思路:并查集维护连通性 代码: //#pragma GCC optimize(3) //#pragma comment(linker, "/STACK:102400000,102400000") //c++ // #pragma GCC diagnostic error &quo…
2018 German Collegiate Programming Contest (GCPC 18) Attack on Alpha-Zet 建树,求lca 代码: #include <algorithm> #include <iterator> #include <iostream> #include <cstring> #include <cstdlib> #include <iomanip> #include <bit…
题目来源 The 2018 ACM-ICPC China JiangSu Provincial Programming Contest 35.4% 1000ms 65536K Persona5 Persona5 is a famous video game. In the game, you are going to build relationship with your friends. You have N friends and each friends have his upper b…
layout: post title: (寒假开黑gym)2018 ACM-ICPC, Syrian Collegiate Programming Contest(爽题) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces - DP - 状态压缩 - LCA 传送门 付队! C - Greetings! (状态压缩) 题意 给N种信件,你可以任意选择K种信封装信件,问你最少的浪费是多少 不能大的信件装…
2018 Multi-University Training Contest 4 6333.Problem B. Harvest of Apples 题意很好懂,就是组合数求和. 官方题解: 我来叨叨一些东西. 这题肯定不能一个一个遍历求和,这样就上天了... 解释一下官方题解的意思. 为什么 sum(n,m)=2*sum(n-1,m)-c(n-1,m). 因为c(n,m)=c(n-1,m)+c(n-1,m-1),至于为什么成立,不懂的百度一下组合数和杨辉三角吧... sum(n,m)=c(n,…