Codeforces Round #411 A. Fake NP】的更多相关文章

A. Fake NP time limit per test   1 second memory limit per test   256 megabytes   Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path. You are given l and r. For all integer…
A. Fake NP time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.…
来自FallDream的博客,未经允许,请勿转载,谢谢. 由于人傻又菜 所以这次又滚去div2了  一堆结论题真的可怕 看见E题不是很有思路   然后就去大力搞F题  T了最后一个点 真的绝望   但是还是上紫了 感觉每次cf都在乱打 我好菜啊都不会 A.Fake NP 给定l和r,求[l,r]中的数的因数中出现次数最多的那一个 sb题 如果l和r相同输出它 不然输出2 #include<iostream> #include<cstdio> #include<cstring&…
A. Fake NP 题意:给你l,r,让你输出[l,r]里面除1以外的,出现因子数量最多的那个数. 题解:如果l==r输出l,否则都输出2 #include<bits/stdc++.h> using namespace std; int main(){ int l,r; cin>>l>>r; if(r-l==0){ cout<<l<<endl; return 0; } int ans = 0; int num = 0; for(int i=2;…
比赛时候切了A-E,fst了A Standings第一页只有三个人挂了A题,而我就是其中之一,真™开心啊蛤蛤蛤 A. Fake NP time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak…
A. Fake NP 题意:询问一个区间[L,R]出现次数最多的正整数因子(>1). 一个区间内一个因子P出现次数大概为[R/P]-[(L-1)/P],约等于(R-L+1)/P,P取2时最优.注意L=R时,且L为奇数输出L即可. B. 3-palindrome 题意:要求用'a','b','c'组成长度为n的字符串,并且没有长度为3的回文串,还要使‘c’出现次数最少. 没有长度为3的回文串,等于没有长度为奇数(>1)的回文串.直接循环输出aabbaabb..... C. Find Amir 题…
A Fake NP standard input/output s, MB Submit Add to favourites x3673 B -palindrome standard input/output s, MB Submit Add to favourites x3760 C Find Amir standard input/output s, MB Submit Add to favourites x3503 D Minimum number of steps standard in…
题目大意:给出一个森林,每次询问给出u,v,问从u所在连通块中随机选出一个点与v所在连通块中随机选出一个点相连,连出的树的直径期望(不是树输出-1).(n,q<=10^5) 解法:预处理出各连通块的直径和各点到连通块内一点的最远距离d[x](树形dp+换根),询问若在同一块内输出-1,否则若随机选出两点x,y,直径为max(d[x]+d[y]+1,x所在块直径,y所在块直径),我们把同一连通块内的d排序,枚举小的连通块中的d,到大的连通块中二分d[x]+d[y]+1<=max(x所在块直径,y…
D. Minimum number of steps time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output We have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of s…
C. Find Amir time limit per test   1 second memory limit per test   256 megabytes   A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends. There…