【CodeforcesRound#277.5(Div.2)(C题)_html/css_WEB-ITnose】教程文章相关的互联网学习教程文章

CodeforcesRound#257(Div.2)_html/css_WEB-ITnose

Orz。。。不吐槽这次比赛了。。。还是太弱了。。 A. Jzzhu and Children time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n children in Jzzhus school. Jzzhu is going to give some candies to them. Lets number all the children from 1 to n. Th...

CodeforcesRound#257(Div.2)B.JzzhuandSequences_html/css_WEB-ITnose

B. Jzzhu and Sequences time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output 题目意思很简单 给出三个数x,y,n,其中x=f1,y=f2 fi+1=fi-fi-1; 求出fn%(10^9+7) 一个周期函数。。。。。水过 #include#define M 1000000007#define N 2000000000+5using namespace std;int main(){ ...

CodeforcesRound#FF(Div.1)-A,B,C_html/css_WEB-ITnose

A:DZY Loves Sequences 一开始看错题了。。sad。 题目很简单,做法也很简单。DP一下就好了。 dp[i][0]:到当前位置,没有任何数改变,得到的长度。 dp[i][1]:到当前位置,改变了一个数,得到的长度 不过需要正向求一遍,然后反向求一遍。 #include#include#include#include#includeusing namespace std;#define maxn 110000int dp[maxn][3];int num[maxn];int a[maxn];int n;void dos(int maxx){ memset(dp,0,sizeof(dp)...

CodeforcesRound#259(Div.1)??LittlePonyandExpectedMaximum_html/css_WEB-ITnose

题目连接 题意: 输入n、m,表示一个n面的色子(面上的值为1-n),投掷m次,求得到的最大值的期望(1?≤?m,?n?≤?105). 分析: 假设当前得到的最大值是Max,那么对应的概率是:sigma(C(m,k) * ((1 / n) ^ k )*(((Max - 1) / n) ^ (m - k)) ),(1 <= k <= n);化简就可以得到:sigma(C(m,k) * ((1 / n) ^ k )*(((Max - 1) / n) ^ (m - k)) ) - ((Max - 1) / n) ^ m,(0 <= k <= n);前半部分由二项式可以得到M...

CodeforcesRound#257(Div.2)D题:JzzhuandCities删特殊边的最短路_html/css_WEB-ITnose

D. Jzzhu and Cities time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are mroads connecting the cities. One can go from city u...

CodeforcesRound#258(Div.2)DevuandFlowers容斥原理_html/css_WEB-ITnose

题目: Codeforces Round #258 (Div. 2)Devu and Flowers 题意:n个boxes ,第i个box有fi个flowers,每个boxes中的flowers完全相同,不同boxes的flowers不同,求从n个boxes中取出s个flowers的方案数。n#include <bits\stdc++.h>using namespace std;const int MOD = 1e9 + 7;typedef long long LL;LL invv[25];LL inv(LL x)/// 求逆元{ return x == 1 ? 1LL : (MOD - MOD / x) * inv (MOD % x) % MOD;}LL Cmn(LL n, LL m) //...

CodeforcesRound#253DIV1C贪心_html/css_WEB-ITnose

http://codeforces.com/contest/442/problem/C 题意很easy,基本上肯定有坑坑洼洼的样子,看题目案例,从第三个跟第二个没有凹的案例来看的话,多写几个以及多画画过程稍微推一下就会发现,除了最大的两个数以外都可以得到,然后就是凹的情况了,凹的情况肯定是唯一的,把中间的数除去得到一个值,但是凹凸有结合该怎么办,猜一把先把凹的单独一个个给解决了,产生没有凹的序列再处理,然后刚好对于第一个案例进行测试,发现答案正...

CodeforcesRound#259(Div.2)题解_html/css_WEB-ITnose

A. Little Pony and Crystal Mine time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Twilight Sparkle once got a crystal from the Crystal Mine. A crys...

CodeforcesRound#224(Div.2)D暴力搜索加记忆化_html/css_WEB-ITnose

题意读了半年,英语太渣,题意是摆两个棋子在棋盘上作为起点,但是起点不能在#上,然后按照图的指示开始走, 右 ^上 v下,走的时候只能按照图的指示走,如果前方是 #的话,可以走进去,但是 走进去之后便不能再走了,走的途中两个棋子不能相碰,但是最终都走到同一个#里是没事的,并且若是能走 无限步的话 输出 -1, 例如 > 一开始被输出-1给困住了,因为除了 .> <这样以外 还可以刚好形成一个圈,这样不太好判,而且不太敢写...

CodeforcesRound#259(Div.2)ABC三连发_html/css_WEB-ITnose

A. Little Pony and Crystal Mine time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Twilight Sparkle once got a crystal from the Crystal Mine...

CodeforcesRound#260(Div.2)B.FedyaandMaths(循环节)_html/css_WEB-ITnose

题目链接:http://codeforces.com/problemset/problem/456/B B. Fedya and Maths time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Fedya studies in a gymnasium. Fedyas maths hometask is to calculate the following expression: (1n?+?2n?+?3n?+?4n) mod 5 ...

CodeforcesRound#260(Div.1)??Civilization_html/css_WEB-ITnose

题目链接 题意: n个点,m条边的森林,q次操作。每次操作:1、询问x所在树的直径 2、合并x和y所在的树,使得合并后的直径最小 (1?≤?n?≤?3105; 0?≤?m?<?n; 1?≤?q?≤?3105) 分析: 没有读到图是森林。。。做的好纠结 最开始将每个树都求一下直径,之后使用并查集处理,每次合并直径:至少是两个树的直径,或者将两个直径的最中间的部分连接求直径 const int MAXN = 310000;int rt[MAXN], ans[MAXN];VI G[MAXN];bool vis...

CodeforcesRound#261(Div.2)C题(思维题)_html/css_WEB-ITnose

C. Pashmak and Buses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to...

CodeforcesRound#261(Div.2)D树状数组应用_html/css_WEB-ITnose

看着题意:[1,i]中等于a[i]的个数要大于[,jn]中等于a[j]的个数 且i int n;int aa[1000000 + 55];int bb[1000000 + 55];int c[1000000 + 55];map<int ,int > mp;ll lowbit(ll x) { return x&(-x);}void add(int i,int val) { while(i <= n) { c[i] += val; i += lowbit(i); }}ll get_sum(int i) { ll sum = 0; while(i) { sum += c[i]; i -= lowbit(i); } return sum;}void init() { memset(c,0,sizeof(c)); memset(aa,0,si...

CodeforcesRound#261(Div.2)459A.PashmakandGarden(数学题)_html/css_WEB-ITnose

题目链接:http://codeforces.com/problemset/problem/459/A A. Pashmak and Garden time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pashmak has fallen in love with an attractive girl called Parmida since one year ago... Today, Pashmak set up a me...