[Codeforces]852A - Digits】的更多相关文章

题目大意:给一个10^200000以内的数字,支持一种操作:在数字之间加若干个加号,把原数字变为加法运算后的结果,要求在三次操作内把数字变成个位数,输出方案. 做法:直观的想法是每两位之间都塞加号,事实证明这样并不一定最优,比如第一次操作后得到1399999,最后一次会得到13.我写了一个比较科学的玄学做法,因为如果这种贪心不够优,第一次得到的数各位和一定比较大,而得到的这个数再加上一些小数字各位和就容易变小,于是如果贪心不行,我就在第一次操作的时候随便把一些两位合并,然后再贪心,不知道能不能被…
B. Anton and Digits 题目连接: http://codeforces.com/contest/734/problem/B Description Recently Anton found a box with digits in his room. There are k2 digits 2, k3 digits 3, k5 digits 5 and k6 digits 6. Anton's favorite integers are 32 and 256. He decide…
[codeforces 509]C. Sums of Digits 试题描述 Vasya had a strictly increasing sequence of positive integers a1, ..., an. Vasya used it to build a new sequence b1, ..., bn, where bi is the sum of digits of ai's decimal representation. Then sequence ai got lo…
Problem D. Digits 题目连接: http://codeforces.com/gym/100531/attachments Description Little Petya likes integers. Recently he has learned about different properties of sums of number's digits. For example, if the sum of number's digits is divisible by 9,…
Maximum Sum of Digits You are given a positive integer n. Let S(x)S(x) be sum of digits in base 10 representation of xx , for example, S(123)=1+2+3=6S(123)=1+2+3=6 , S(0)=0S(0)=0 . Your task is to find two integers a,ba,b , such that 0≤a,b≤n0≤a,b≤n ,…
http://codeforces.com/problemset/problem/489/C C. Given Length and Sum of Digits... time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a positive integer m and a non-negative integer …
[题目链接]:http://codeforces.com/contest/509/problem/C [题意] 给你一个数组b[i] 要求一个严格升序的数组a[i]; 使得a[i]是b[i]各个位上的数的和; 并且a[n]最小; [题解] 每次处理的时候; 算出b[i]-b[i-1]的值 设为d 如果d>0 则从个位开始,不断地加1,直到d变成0; 如果个位变成9了,就加到十位,(这个时候个位的数字9不变,因为在低位,数字大一些,可以为后面高位的数字"分压",后面的数字就能小一些…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Recently Anton found a box with digits in his room. There are k2 digits 2, k3 digits 3, k5 digits 5 and k6 digits 6. Anton's favorite integers ar…
链接: https://codeforces.com/contest/1209/problem/C 题意: You are given a sequence of n digits d1d2-dn. You need to paint all the digits in two colors so that: each digit is painted either in the color 1 or in the color 2; if you write in a row from left…
链接: https://codeforces.com/contest/1228/problem/A 题意: You have two integers l and r. Find an integer x which satisfies the conditions below: l≤x≤r. All digits of x are different. If there are multiple answers, print any of them. 思路: 水题. 代码: #include…