Codeforces 1373E - Sum of Digits (构造) Description题目大意: f(x)f(x)为十进制下x每一位上的数字的和。求满足f(x)+f(x+1)+...+f(x+k)=nf(x)+f(x+1)+...+f(x+k)=n的最小x。思路由于k特别小(<=9),故x+k至多发生一次进位。x每加1,必有某一位加上1。如果发生进位,那么f(x)f...
Petya wonders eagerly what minimum lucky number has the sum of digits equal ton. Help him cope with the task. The single line contains an integern(1 ≤ n ≤ 106) — the sum of digits of the required lucky number. Print on the single line the result — the minimum lucky numb...
Maximum Sum of Digits(CodeForces 1060B) Description You are given a positive integer nn. Let S(x) be sum of digits in base 10 representation of xx, for example, S(123)=1+2+3=6, S(0)=0. Your task is to find two integers a,ba,b, such that 0≤a,b≤n, a+b=n and S(a)...
Anton has the integerx. He is interested what positive integer, which doesn't exceedx, has the maximum sum of digits. Your task is to help Anton and to find the integer that interests him. If there are several such integers, determine the biggest of them. The first line contains the po...
mand a non-negative integers. Your task is to find the smallest and the largest of the numbers that have lengthmand sum of digitss. The required numbers should be non-negative integers written in the decimal base without leading zeroes. ...
x. He is interested what positive integer, which doesn't exceedx, has the maximum sum of digits. Your task is to help Anton and to find the integer that interests him. If there are several such integers, determine the biggest of them. ...
1926A-VladAndTheBestOfFive.cpp 1926B-VladAndShapes.cpp 1926C-VladAndASumOfSumOfDigits.cpp 1926D-VladAndDivision.cpp 1927A-MakeItWhite.cpp 1927B-FollowingTheString.cpp 1927C-ChooseTheDifferentOnes.cpp 1927D-FindTheDifferentOnes.cpp 1927E-KleverPermutation.cpp 1928A-RectangleCutting.cpp 1928B-Equa...
Let function S(X) equal sum of X's digits. For ex: S(357) = 3 + 5 + 7 = 15 Given M and N (0 < M, N <= 10^12). Find the minimum number K such that: a1 + a2 + ... + aK = N S(a1) + S(a2) + ... + S(aK) = M ...
Here's theproblemfrom LightOJ. It says to calculate sod(n) [sum of digits of n] while n >= 10. Here n = a^b, (0<= a,b <= 10^50,000 and a+b>0 ) I got the solution idea fromthiscf post. It can be proven that the repeated digit sum of N is 1 + (N - ...
CodeForces Algorithms. Contribute to DionysiosB/CodeForces development by creating an account on GitHub.