题目链接:http://codeforces.com/problemset/problem/1060/BTime limit per test: 2 seconds Memory limit per test: 512 megabytesProblem DescriptionYou are given a positive integern.Let S(x)be sum of di...
原创 2021-07-14 10:47:44
211阅读
http://acm.hdu.edu.cn/showproblem.php?pid=3022 题意: 最多不超过10000组数据,每组数据给定两个数n,m,求一个最小的数,使得该数每一位之和等于n,每一位的平方和等于m。 若无解或者答案超过100位,输出no solution。 n最大=900,m最
原创 2021-08-05 10:59:43
52阅读
Sum of Digits / Digital RootIn this kata, you must create adigital rootfunction.A digital root is therecursive sum of all the digits in a number.Given...
转载 2015-07-09 15:30:00
120阅读
2评论
题目链接:http://codeforces.com/problemset/problem/1060/BTime limit per test: 2 seconds Memory limit per test: 512 megabytesProblem DescriptionYou are given a positive integern.Let S(x)be sum of di...
原创 2022-02-03 14:12:27
287阅读
Sum of Digits Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 810 Accepted Submission(s): 220 Pro
原创 2021-12-31 11:07:33
120阅读
链接这题卡了挺久了 昨天试着用类似dfs的方法直接TLE在第二组 看了下题解,,发现s1,s2的范围是个幌子。。100位最大的s1900 s28100 觉得s1s2太大不敢开二维。。这样就简单了 类似背包 dp[s1][s2]表示组成s2s2最少的位数 其实就是装进去多少个数字 正好把s1s2装满把DP部分预处理之后放在外面 不然会超时 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define INF 0xfffffff 8 int s1,s2; 9 int dp[920][.
转载 2013-09-10 09:43:00
345阅读
2评论
题意:有一个不多于100位的数字,满足各位之和为S1,各位平方之和为S2,求满足该条件的最小数字思路:首先要理解,S1#include #i
原创 2023-06-12 14:08:36
45阅读
题目题意翻译记 S(x)的各个数位之和例如:S(123)=1+2+3=6,S(0)=0。给定整数 n\ \left(1 \le n \le 10^{12}\right)n (1≤n≤1012) ,求一对自然数 a, b\ (0 \le a, b \le n)a,b (0≤a,b≤n),使得 S(a)+S(b)S(a)+S(b) 最大。输出这个最大值。题目描述You are give...
原创 2021-07-13 14:59:30
60阅读
Given an integer n (in base 10) and a base k, return the sum of the digits of n after converting n from base 10 to base k. After converting, each digi
转载 2021-04-25 15:10:00
205阅读
2评论
Given an integer number n, return the difference between the product of its digits and the sum of its digits. Example 1: Input: n = 234 Output: 15 Exp
转载 2019-12-19 05:33:00
112阅读
2评论
1281. Subtract the Product and Sum of Digits of an Integer*https://leetcode.com/problems/subtract-the
原创 2022-05-30 12:44:43
105阅读
点击打开链接 B. Maximize Sum of Digits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Anton has the intege
原创 2022-09-07 16:33:25
53阅读
D. Decrease the Sum of Digitsemm贪心的想,先把数字n从高位到低位的数位预处理出来emm贪心的想,先把数字n从高位到低位的数位预处理出来emm贪心的想,先把数字n从高位到低位的数位预处理出来然后从高位看到低位(高位能不动就不动的原则),现在考虑如何构造最小的数b然后从高位看到低位(高位能不动就不动的原则),现在考虑如何构造最小的数b然后从高位看到低位(高位能不动就不动的原则),现在考虑如何构造最小的数b设前i位数字和是sumn(前i位指的是高位到低位)设前i位数字和是su
原创 2021-08-26 16:03:42
82阅读
难度 1400 题目 Codeforces: C. Given Length and Sum of Digits... time limit per test 1 second memory limit per test 256 megabytes You have a positive integ ...
转载 2021-08-28 23:53:00
30阅读
2评论
D. Decrease the Sum of Digitsemm贪心的想,先把数字n从高位到低位的数位预处理出来emm贪心的想,先把数字n从高位到低位的数位预处理出来emm贪心的想
原创 2022-02-10 15:22:03
52阅读
You are given a string s consisting of lowercase English letters, and an integer k. First, convert s into an integer by replacing each letter with its
转载 2021-07-30 23:00:00
226阅读
2评论
#include #include #include #include #include #include #include #include #include #inclaxm 200005#define eps 1e-10#defin
原创 2023-07-05 18:57:17
32阅读
题目: Given Length and Sum of Digits ,哈哈,我们今天来看一道比较简单的贪心题,虽然比较简单,但是如果不仔细的话很容易出tive integer s.
原创 2024-04-19 11:39:55
23阅读
DescriptionGiven an integer number n, return the difference between the product of
git
原创 2022-08-11 17:29:54
62阅读
目录1.题目2.思路3.AC代码1.题目You are given a positive integer n. In one move, you can increase n by one (i.e. make n:=
原创 2022-06-10 17:22:08
89阅读
  • 1
  • 2
  • 3
  • 4
  • 5