Codeforces Helpful Maths
来源:互联网 发布:关键词排名优化方案 编辑:程序博客网 时间:2024/04/29 22:58
这样的题目因为关键字少,所以就可以转换为counting sort的思想去解决。这样时间效率就只有O(n)了。
void HelpfulMaths(){int A[4] = {0};int a;while (scanf("%d", &a) != EOF){A[a]++;getchar();}int total = A[1]+A[2]+A[3]-1;for (unsigned i = 0; i < A[1]; i++, total--){printf("1");if (total) printf("+");}for (unsigned i = 0; i < A[2]; i++, total--){printf("2");if (total) printf("+");;}for (unsigned i = 0; i < A[3]; i++, total--){printf("3");if (total) printf("+");}}
1 0
- Codeforces Helpful Maths
- 【CodeForces】A. Helpful Maths
- CodeForces 339A Helpful Maths
- CodeForces-339A-Helpful Maths
- codeforces 339A Helpful Maths
- Problem--339A--Codeforces-- A. Helpful Maths
- CodeForces 339 A.Helpful Maths(水~)
- Helpful Maths
- Helpful Maths
- Helpful Maths
- codeforces 339A.Helpful Maths B.Xenia and Ringroad 两水题
- Codeforces Round #197 (Div. 2) A. Helpful Maths
- Codeforces Round #197 (Div. 2)A. Helpful Maths
- codeforces——339A——Helpful Maths
- A. Helpful Maths
- codeforce Helpful Maths
- A. Helpful Maths
- 339A - Helpful Maths
- ssh 命令
- 算法重要,但并非全部,并非所有人的选择
- Proguard语法及常用proguard.cfg代码段
- Custom Scrollbars in WebKit
- "->"的用法
- Codeforces Helpful Maths
- 第8周作业1——类与对象练习之TV
- codeforces Epic Game 题解
- FreeMarker系列学习笔记(2)
- 重大发现:MSDN for DOS - Microsoft Library 1.03
- 首届中国智慧城市协同创新峰会将于6月20日在大连隆重举行
- h3c和瑞斯康达面试经验
- 50个Android开发技巧(20 使用MVP模式)
- Multiply Strings