【codeforces 746E】Numbers Exchange】的更多相关文章

[题目链接]:http://codeforces.com/problemset/problem/746/E [题意] 你有n张卡片,上面写着不同的数字; 然后另外一个人有m张上面写着不同的数字的卡片:卡片上的数字从1..m; 你可以和另外一个人交换卡片; 问你最少的交换次数; 使得你的n张卡片里面,卡片上的数字为奇数的和卡片上的数字为偶数的张数相同. 且这n张卡片不能有相同的数字; [题解] 首先考虑去重的工作; 在去重之前;先算出; 原来的n张卡片里面,卡片上的数字是奇数的数字个数odd; 然…
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=2000),问满足[数列长度是k && 数列中每一个元素arr[i]在1~n之间 && 数列中元素可以重复]的数列有多少个?结果对10^9+7取余 解题思路:dp[i][j]表示长度是j,最后一位是i的种数 if(kk%i==0) dp[kk][j+1]+=dp[i][j] #inc…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Andrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famous Stolp's gears, pu…
[题目链接]:http://codeforces.com/problemset/problem/367/C [题意] 我们称一个数列a[N]美丽; 当且仅当,数列中出现的每一对数字都有相邻的. 给你n的大小; 以及m个数字以及它们的使用花费; 问你最多能花费多少钱; 使得选择的这些数字能够构成一个长度为n的美丽数列; [题解] 显然选什么数字,只要是不一样的就可以了;和数字具体是什么无关; 要算出的就是最多能选几个数字N; 这里,数字的相邻关系能构成一张图; 完全图->每个点都与其他n-1个点有…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Roman planted a tree consisting of n vertices. Each vertex contains a lowercase English letter. Vertex 1 is the root of the tree, each of the n …
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Andrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary art. The main…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output After Vitaly was expelled from the university, he became interested in the graph theory. Vitaly especially liked the cycles of an odd length in w…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Soon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there. At a meeting of the jury of the Olympiad…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output After seeing the "ALL YOUR BASE ARE BELONG TO US" meme for the first time, numbers X and Y realised that they have different bases, which co…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maximum point valu…