地址
http://acm.hdu.edu.cn/showproblem.php?pid=2000
定位
字典排序
水题
分析
- 直接使用 C++ 标准库中的 sort() 进行字典排序
代码
- #include <iostream>
- #include <algorithm>
- #include <stdio.h>
- #include <string.h>
- using namespace std;
- int main() {
- char ch[3];
- while(scanf(“%s”,ch)!=EOF) {
- sort(ch,ch+3,less<char>());
- printf(”%c %c %c\n”,ch[0],ch[1],ch[2]);
- }
- return 0;
- }
性能
| Exe.Time | Exe.Memory | Code Length | Language |
|---|---|---|---|
| 0MS | 1868K | 286B | c++ |
本文介绍了一种利用C++标准库中的sort()函数进行字典排序的方法,并提供了一个简单的示例程序,该程序能够接收三个字符输入并按字典顺序输出。
1361

被折叠的 条评论
为什么被折叠?



