题目链接: 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 ]…
题目传送门 /* 题意: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 ************************************************…
http://codeforces.com/contest/465/problem/C 给定n和m,以及一个字符串s,s不存在长度大于2的回文子串,如今要求输出一个字典比s大的字符串,且串中字母在一定范围内,而且说相同不存在长度大于2的回文子串. 直接去递归构造就可以.从最后一位開始.每次仅仅要推断是否子串中含有回文串,事实上细致想想仅仅要考虑是否存在一个字符和前两个字符中的一个同样就可以.不卡时限,裸的推断都能过 #include <cstdio> #include <cstdlib&…
http://codeforces.com/contest/465/problem/D 给定8个点坐标,对于每个点来说,可以随意交换x,y,z坐标的数值.问说8个点是否可以组成立方体. 暴力枚举即可,注意检查立方体姿势不对会T 如果8个点形成一个立方体是这样的:找到所有点对之间的最小距离,应等于边的长度L.每个顶点应该正好有三个点距离它为L,而且构成的三个边应两两垂直.如果这些条件都满足在每一点上,那么一定只能是立方体.检查复杂度约O(8^2). #include <cstdio> #incl…
http://codeforces.com/contest/465/problem/C 给定n和m,以及一个字符串s,s不存在长度大于2的回文子串,现在要求输出一个字典比s大的字符串,且串中字母在一定范围内,并且说同样不存在长度大于2的回文子串. 直接去递归构造即可,从最后一位开始,每次只要判断是否子串中含有回文串,其实仔细想想只要考虑是否存在一个字符和前两个字符中的一个相同即可.不卡时限,裸的判断都能过 #include <cstdio> #include <cstdlib> #…
http://codeforces.com/contest/465/problem/D 给定8个点坐标.对于每一个点来说,能够任意交换x.y,z坐标的数值. 问说8个点能否够组成立方体. 暴力枚举就可以,注意检查立方体姿势不正确会T 假设8个点形成一个立方体是这种:找到全部点对之间的最小距离,应等于边的长度L.每一个顶点应该正好有三个点距离它为L.并且构成的三个边应两两垂直.假设这些条件都满足在每一点上.那么一定仅仅能是立方体.检查复杂度约O(8^2). #include <cstdio> #…
http://codeforces.com/contest/465 rating+7,,简直... 感人肺腑...............蒟蒻就是蒟蒻......... 被虐瞎 a:inc ARG 题意:将串反过来后+1问有多少个位变化.. ..我是模拟的.. #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <iostream> #i…
这题说的是给了数字的字符串 然后有n种的操作没次将一个数字替换成另一个字符串,求出最后形成的字符串的 数字是多大,我们可以逆向的将每个数推出来,计算出他的值和位数记住位数用10的k次方来记 1位就是10 2位就是100,这样是为了防止当位数很大的时候存不下这样可以直接的进行mod操作 #include <iostream> #include <cstdio> #include <string.h> #include <cmath> #include <…
Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program shows the cont…
D. World of Darkraft - 2 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Roma found a new character in the game "World of Darkraft - 2". In this game the character fights monsters, fi…
C. No to Palindromes! time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of th…
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…
D. Soldier and Number Game time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to the…
[Link]:http://codeforces.com/contest/835 [Description] 原本有一个数字x,它的各个数码的和原本是>=k的; 现在这个数字x,在不改变位数的情况下,变成了n; 问你n和原来的数字x最少可能有多少位不一样. (x是未知的) [Solution] 如果各位大于等于k,直接输出0; 否则,先把n小的数码加到9; 一直加知道大于等于k; [NumberOf WA] 0 [Reviw] [Code] #include <bits/stdc++.h>…
题意 给你a,b(1<=b<=a<=5000000)表示a!/b!表示的数,你每次可以对这个数除以x(x>1且x为这个数的因子)使他变成a!/b!/x, 问你最多可以操作多少次使这个数变成1 http://codeforces.com/problemset/problem/546/D 思路 显然要素因子分解,但直接计算a!/b!的素因子个数太慢了,可以发现实际上是计算a(a-1)(a-2)--(b+1),而这些数之积的所有素因子个数之和是等于每个数的素因子个数之和的(相当于对每一个…
D. Soldier and Number Game time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to the…
#include <iostream> #include <algorithm> #include <vector> #include <numeric> using namespace std; int main(){ int n; cin >> n; vector<); ; i < n; ++ i ){ cin >> x[i]; } bool flag = true; while(flag){ flag = false…
F. Restore a Number   Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k — the number of digits in n. Magically, all the numbers were shuffled in arbitrary order whil…
题目传送门 /* WA了好几次,除了第一次不知道string不用'\0'外 都是欠考虑造成的 */ #include <cstdio> #include <cmath> #include <string> #include <cstring> #include <iostream> #include <algorithm> #include <map> #include <set> #include <v…
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…
Some natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of the number didn't change. You h…
D. Soldier and Number Game time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output -> Link <- 题目链接呈上: 题意:两个人玩游戏,其中一个人选一个数n给另外一个人,然后每轮选一个数x使得n能被x整除,然后用n/=x;注意x>1:问要使得另一个人得分最高,最高多少:即最多能够玩几轮n变成了1…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 直接暴力求出第k个perfect数字就好. 纯模拟. [代码] #include <bits/stdc++.h> #define double long double using namespace std; int n; int _judge(int x){ int num = 0; while (x){ num+=x%10; x/=10; } return num==10; } int main(){ #ifdef LOC…
B. Split a Number time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Dima worked all day and wrote down on a long paper strip his favorite number n consisting of l digits. Unfortunately, the stri…
Split a Number time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Dima worked all day and wrote down on a long paper strip his favorite number nn consisting of ll digits. Unfortunately, the s…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…