A. Guess a number! time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching th…
题目传送门 /* 题意:b+1,b+2,...,a 所有数的素数个数和 DP+埃氏筛法:dp[i] 记录i的素数个数和,若i是素数,则为1:否则它可以从一个数乘以素数递推过来 最后改为i之前所有素数个数和,那么ans = dp[a] - dp[b]: 详细解释:http://blog.csdn.net/catglory/article/details/45932593 */ #include <cstdio> #include <algorithm> #include <cs…
题目传送门 /* 题意:这题就是求b+1到a的因子个数和. 数学+DP:a[i]保存i的最小因子,dp[i] = dp[i/a[i]] +1;再来一个前缀和 */ /************************************************ Author :Running_Time Created Time :2015-8-1 14:08:34 File Name :B.cpp ************************************************…
B. Art Union time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A well-known art union called "Kalevich is Alive!" manufactures objects d'art (pictures). The union consists of n painters…
B. Art Union time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A well-known art union called "Kalevich is Alive!" manufactures objects d'art (pictures). The union consists of n painters…
B. Art Union time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A well-known art union called "Kalevich is Alive!" manufactures objects d'art (pictures). The union consists of n painters…
题意:有\(n\)个画家,\(m\)幅画,每个画家负责\(m\)幅画,只有前一个画家画完时,后面一个画家才能接着画,一个画家画完某幅画的任务后,可以开始画下一幅画的任务,问每幅画最后一个任务完成时的时间. 题解:这题可以用dp来写,当某个画家开始他的任务时,他的上一幅画的任务必须完成,并且他的前一个画家必须完成他的任务,我们用\(dp[i][j]\)表示第\(j\)个画家完成第\(i\)幅画任务时的时间,因为如果要合法的话,前面的两个条件都必须要满足,所以我们取两个状态的最大值,从而写出状态转移…
D. Soldier and Number Game Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/546/problem/D Description Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to the second s…
题目链接: http://codeforces.com/contest/464/problem/C J. Substitutes in Number time limit per test 1 secondmemory limit per test 256 megabytes 问题描述 Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends A…
http://codeforces.com/contest/465/problem/E 给定一个字符串,以及n个变换操作,将一个数字变成一个字符串,可能为空串,然后最后将字符串当成一个数,取模1e9+7. 逆向操作,维护每次替换后产生的数值和长度 替换P - > d_1d_2--d_n后 新的P的长度Len[ d_1 ] +--+ Len [ d_n ] 新的P值是Val[ d_n ] + 10 ^(Len [ d_n ])* Val [ d_(n-1)] + 10 ^(Len [ d_n ]…