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

CodeforcesRound#277(Div.2)解题报告_html/css_WEB-ITnose

只会做3道。。TUT。。 A题:Calculating Function 水。每两项为1.对奇偶性分类讨论。 代码如下: #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define LL __int64const int INF=0x3f3f3f3f;int main(){ LL n, x; scanf("%I64d",&n); x=n/2; if(n&1) printf("%I64d\n",x-n); else printf("%I64d\n",x); ...

CodeforcesRound#275(Div.1)D(树形DP)_html/css_WEB-ITnose

D. Random Function and Tree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a rooted tree consisting of n vertices. Lets number them with integers from 1 to n inclusive. The root of the tree is the vertex 1. For each i?>?1 d...

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

Codeforces Round #277 (Div. 2) A. Calculating Function time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output For a positive int...

CodeforcesRound#275(Div.1)C(状压+期望)_html/css_WEB-ITnose

C. Game with Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You play the game with your friend. The description of this game is listed below. Your friend creates n distinct strings of the same length m and tells you all ...

CodeforcesRound#105(Div.2)D概率DP_html/css_WEB-ITnose

题目 呃 琢磨了半天还是琢磨出来了,题意有些模糊哈,有w个白色物品,b个黑色物品,A,B轮着抽,A先开始,谁先抽到白色谁赢,若最终都没有抽到白色 则算B赢,抽出来的物品不会放回去,B抽完以后 物品还会有一个额外产生丢失,问A赢的概率为多少 依旧是以目标状态为边界,当前状态到目标状态所需要的概率为 方程 dp[i][j] 代表当前轮到A抽的时候,还有i个白色的j个黑色的A赢的概率为多少 则当前转移可能有四种 1:A抽到了白色的,...

CodeforcesRound#277.5(Div.2)-D_html/css_WEB-ITnose

题意:求该死的菱形数目。直接枚举两端的点,平均意义每个点连接20条边,用邻接表暴力计算中间节点数目,那么中间节点任选两个与两端可组成的菱形数目有r*(r-1)/2. 代码: #include#include#include#include#include#include#define rep(i,a,b) for(int i=(a);i<(b);i++)#define rev(i,a,b) for(int i=(a);i>=(b);i--)#define clr(a,x) memset(a,x,sizeof a)typedef long long LL;using namespace std;const int mod=1e9 +7;...

CodeforcesRound#226(Div.2)C数论_html/css_WEB-ITnose

题目: CF机子真心强大啊,这样才跑了600ms,给了你n个数的序列,然后m次询问,每次询问求出序列中每个数是 区间[a,b]内的 几个素数的倍数统计一下,然后对于个数求和,看了题目下面的hint很易懂,然后看到a,b的范围有些大哈,2*10^9,不知道怎么处理,但是后来发现,序列中的数 最大为10^7,所以就算a,b,再大也无所谓的,大于序列中的最大数的部分的素数,序列中不会有任何数 是它倍数的,然后就是对10^7以内的 素数进行预处理,...

CodeforcesRound#277.5(Div.2)-B.BerSUBall(贪心)_html/css_WEB-ITnose

BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves....

CodeforcesRound#277(Div.2)-A.CalculatingFunction(规律)_html/css_WEB-ITnose

Calculating Function time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output For a positive integer n lets define a function f: f(n)?=??-?1?+?2?-?3?+?..?+?(?-?1)nn Your task is to calculate f(n) for a given integer n. Input The single line...

CodeforcesRound#277.5(Div.2)-C.GivenLengthandSumofDigits(贪心)_html/css_WEB-ITnose

Given Length and Sum of Digits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The requi...

CodeforcesRound#277.5(Div.2)-C_html/css_WEB-ITnose

简单细节题: #include#include#include#include#include#include#define rep(i,a,b) for(int i=(a);i<(b);i++)#define rev(i,a,b) for(int i=(a);i>=(b);i--)#define clr(a,x) memset(a,x,sizeof a)typedef long long LL;using namespace std;const int mod=1e9 +7;const int maxn=105;const int maxm=905;int da[maxn],db[maxn];int main(){ int n,m; while(~scanf("%d%d",&n,&m)) { if(m>9*n||(n!=1&&m==0))...

CodeforcesRound#277.5(Div.2)D??UnbearableControversyofBeing_html/css_WEB-ITnose

D. Unbearable Controversy of Being time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Tomash keeps wandering off and getting lost while he is walking along the streets of Berland. Its no su...

CodeforcesRound#277.5(Div.2)B??BerSUBall_html/css_WEB-ITnose

B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are...

CodeforcesRound#277(Div.2)-C.PalindromeTransformation(贪心)_html/css_WEB-ITnose

Palindrome Transformation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nam is playing with a string on his computer. The string consists of n lowercase English letters. It is meaningless, so Nam decided to make the string more beautiful, that is to m...

CodeforcesRound#277.5(Div.2)C??GivenLengthandSumofDigits._html/css_WEB-ITnose

C. Given Length and Sum of Digits... time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the...