数位排序简单写法:sorted函数 摘要:解题思路:int(i)for i in str(num):生成器表达式,用于将数字整体分开,看成其组成部分;1.str(num)用于将数字变为字符串,使其不再具有数字的意义,如123变为”123“。2…… 题解列表 2025年02月22日 0 点赞 0 评论 12 浏览 评分:0.0
使用qsort函数和结构体数组 摘要:**思路: 1.输入处理: 输入两个整数 n 和 m。n 是要处理的数字的个数(从 1 到 n),m 是要输出排序后第 m 个数字的索引。 2.数据结构设计: 定义一个结构体 Number,包…… 题解列表 2024年11月19日 0 点赞 0 评论 115 浏览 评分:9.9
2684: 蓝桥杯2022年第十三届省赛真题-数位排序 摘要:解题思路:注意事项:参考代码:n = int(input())m = int(input())l = [i for i in range(1,n+1)]t = []for i in l: s =…… 题解列表 2024年08月12日 0 点赞 0 评论 102 浏览 评分:0.0
题解 2688: 蓝桥杯2022年第十三届省赛真题-技能升级 摘要:解题思路:贱命一条就是干注意事项:无参考代码:#include <stdio.h>#include <stdlib.h>#define max 1000005struct Node { int …… 题解列表 2024年06月16日 0 点赞 0 评论 81 浏览 评分:0.0
数位排序(python) 摘要:``` hash_list=[[] for i in range(55)]#hash_list[n]为各位和为n的数值 hash_list_n=[0 for i in range(55)]#has…… 题解列表 2024年04月12日 0 点赞 0 评论 284 浏览 评分:9.9
2684: 蓝桥杯2022年第十三届省赛真题-数位排序-sort 摘要: #include #include using namespace std; bool cmp(int x,int y){ int sum1=0…… 题解列表 2024年04月08日 3 点赞 0 评论 145 浏览 评分:10.0
JAVA 重写Arrays.sort (超简单) 摘要:解题思路:注意事项:参考代码:import java.util.Arrays;import java.util.Comparator;import java.util.Scanner;public c…… 题解列表 2024年04月08日 0 点赞 0 评论 132 浏览 评分:0.0
数位排序 c++ 摘要:#include using namespace std; int n,m; const int N=1e6; vectorpi; int han(int x) { int sum=…… 题解列表 2024年04月06日 0 点赞 0 评论 127 浏览 评分:0.0
sort函数妙解数位排序 摘要:解题思路:在sort函数中添加优化的比较函数cmp注意事项:数组要比十万大一点参考代码:#include <iostream> #include<algorithm> using namespac…… 题解列表 2024年03月28日 0 点赞 0 评论 70 浏览 评分:0.0
自定义排序 摘要:解题思路:先将每个数的数位之和求出来进行比较,自定义排序会根据最后的返回值看是否会交换两个数的值,就算数位之和相同,arrays函数也会根据值得大小进行排序。注意事项:参考代码:import java…… 题解列表 2024年03月27日 0 点赞 0 评论 143 浏览 评分:9.9