题目描述:https://pycoder.blog.csdn.net/article/details/125923027

想不到这也是一道qsort的题目~

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>char str[1000];
int strArrIndex;
char strArr[1000][6];void input_handler(void)
{char *tmp = NULL;tmp = strtok(str, ",");strcpy(strArr[strArrIndex++], tmp);while (1) {tmp = strtok(NULL, ",");if (tmp == NULL) break;strcpy(strArr[strArrIndex++], tmp);}
}int myCmp(const void *a, const void *b)
{char *aa = (char *)a;char *bb = (char *)b;char tmpA[12] = {0};char tmpB[12] = {0};char tmp[12] = {0};strcpy(tmpA, aa);strcpy(tmp, aa);strcpy(tmpB, bb);int data1 = atoi(strcat(tmpA, tmpB));int data2 = atoi(strcat(tmpB, tmp));return data2 - data1;
}int main(void)
{char res[1000] = {0};strArrIndex = 0;gets(str);input_handler();qsort(strArr, strArrIndex, sizeof(strArr[0]), myCmp);for (int i = 0; i < strArrIndex; i++) {strcat(res, strArr[i]);}printf("%s\n", res);return 0;
}

华为机试C语言-组成最大数相关推荐

  1. 华为机试C语言-最远足迹

    题目描述:https://pycoder.blog.csdn.net/article/details/125531902 https://blog.csdn.net/weixin_44052055/a ...

  2. 华为机试C语言-找到比自己强的人数

    题目描述:https://pycoder.blog.csdn.net/article/details/127216746?spm=1001.2014.3001.5502 https://blog.cs ...

  3. 华为机试C语言-服务失效判断

    题目描述:https://zhuanlan.zhihu.com/p/526678876 https://blog.csdn.net/weixin_39765576/article/details/12 ...

  4. 华为机试C语言-VLAN资源池

    题目描述:https://pycoder.blog.csdn.net/article/details/125175834 #include <stdio.h> #include <s ...

  5. 华为机试C语言-整形数组按个位值排序

    题目描述:https://pycoder.blog.csdn.net/article/details/124600540 #include <stdio.h> #include <s ...

  6. 华为机试C语言-Words重量

    题目描述:https://pycoder.blog.csdn.net/article/details/124743820 #include <stdio.h> #include <s ...

  7. 华为机试C语言-篮球比赛

    题目描述:https://pycoder.blog.csdn.net/article/details/125270003?spm=1001.2014.3001.5502 动态规划 : dp[i] 表示 ...

  8. 华为机试C语言-一个正整数到Excel编号之间的转换

    题目描述:https://blog.csdn.net/qq_23934063/article/details/124676929 #include <stdio.h> #include & ...

  9. 华为机试C语言-欢乐的周末

    题目描述:https://pycoder.blog.csdn.net/article/details/125401136 递归,回溯的时候要考虑周全,不然白理解了. #include <stdi ...

最新文章

  1. Exploring Data with Python免费电子书
  2. 云服务器基础运维与管理
  3. Django框架学习索引
  4. 工频干扰频谱测量_【鼎阳硬件智库译文|高速总线之测试测量】定量测量多通道串行数据系统中的串扰引起的抖动...
  5. 广播,实现强制下线功能(项目文件已上传GitHub)
  6. vue 请求多个api_vue 一个input同时请求两个接口
  7. LV 旗下公司的识别算法: 4 秒鉴定假包,准确率达 99.1%
  8. [当人工智能遇上安全] 1.人工智能真的安全吗?浙大团队外滩大会分享AI对抗样本技术
  9. 财贸企业实行国有民营机制的调查
  10. mysql8出现1045报错+常用的加密plugin汇总
  11. mapreduce web日志预处理
  12. pycharm激活码永久有效2019年5月28日
  13. iOS高仿app源码:10天时间纯代码打造高仿优质《内涵段子》
  14. idea和搜狗输入法快捷键冲突_Win10 输入法简繁体快捷键与 IDEA 冲突
  15. 欧姆龙PLC网关BL110之41:实现欧姆龙 PLC 接入Modbus TCP 云平台
  16. 1038 01背包动态规划
  17. matlab中unifrnd函数用法,概率和统计的MATLAB指令
  18. (application)javaweb中application的用法
  19. 计算机组装活动感悟,电脑组装员实习体会感想-最新版
  20. 个人站——作品集页面设计

热门文章

  1. 类似Cryptonom的区块链游戏开发细节介绍
  2. 小学计算机课标教学大纲的依据,中小学教学大纲为何改成课程标准?
  3. Python 导出手机通讯录文件 VCF 文件中的手机号码
  4. 人工智能是否可能会毁灭地球?
  5. PDF迅捷转换器html网址,如何把PDF转换成HTML?迅捷PDF转换器
  6. 【联邦学习邂逅密码学系列】基于同态加密算法python代码实现
  7. 计算机二级报名在学籍库无法报名,报考计算机二级啦!
  8. Problem : 算式等式
  9. 先搞一波kotlin,看它怎么说
  10. 丹纳赫集团在中国本土研发并生产的首台流式细胞分选仪正式交付