【codeforces 767E】Change-free】的更多相关文章

[题目链接]:http://codeforces.com/problemset/problem/767/E [题意] 你有m个1元硬币和无限张100元纸币; 你在第i天,需要花费ci元; 同时在第i天,收银员有一个不高兴程度wi; 然后如果它要找零x张纸币y枚硬币的话,它的不高兴值会为wi*(x+y) 找的零钱会回到你的口袋里; 问你n天的,总的最小不高兴值; [题解] 整百的部分,直接用纸币填就好了; 则直接对ci%100考虑; 即要直接用硬币填满ci%100,或者是先给一张100,然后让他找…
[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…
[题目链接]:http://codeforces.com/contest/779/problem/E [题意] 给你n个长度为m的二进制数 (有一些是通过位运算操作两个数的形式给出); 然后有一个未知数字,用符号'?'表示; (所有的数字都是长度为m的二进制数); 然后让你确定这个'?'使得n个数字的和最大.最小; [题解] 模拟题; 会有嵌套的情况: 即 a=x & y b=a&? 类似这样. 所以在算b之前,先把a的值确定下来; 明白了怎么算之后; 枚举那个未知数字的m位的每一位; 每…
[题目链接]:http://codeforces.com/problemset/problem/785/E [题意] 给你一个初始序列1..n顺序 然后每次让你交换任意两个位置上面的数字; 让你实时输出q个操作,每个操作过后整个序列逆序对的个数; [题解] 分块法; 分成根号n个块. 每个块按照数字升序排; 然后再用一个a数组具体记录每个位置上的数字; 找逆序对的方式如下: 对于交换l,r 查找l+1..r-1当中比a[l]小的数字,比a[l]大的数字; 查找l+1..r-1当中比a[r]小-比…
[题目链接]:http://codeforces.com/contest/798/problem/C [题意] 给你n个数字; 要求你进行若干次操作; 每次操作对第i和第i+1个位置的数字进行; 将 a[i]变为a[i]-a[i+1],a[i+1]变为a[i]+a[i+1]; 然后问你能不能通过以上变换使得最后所有元素的gcd>1 [题解] 答案总是存在的; 因为把这个操作进行两次可以得到-2*a[i+1],2*a[i] 也就是如果对每相邻的元素进行操作,最后都能使得这两个元素都变成偶数; 最后…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones. Once he thought ab…
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph. There are n vertices in the tree, e…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Kevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number ass…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output It's that time of the year, Felicity is around the corner and you can see people celebrating all around the Himalayan region. The Himalayan regi…