题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2025
会寝室不想看书,没事刷刷水题,嘿嘿。题目没什么好说的,写过了看看网上的代码觉得都差不多,稍稍修改下,直接贴上。
代码:
#include<stdio.h> #include<string.h> int main() { char max,str[101]; int len,i; while(~scanf("%s",str)) { len=strlen(str); max='a'; for(i=0;i<=len-1;i++) { if(str[i]>max) { max=str[i]; } } for(i=0;i<=len-1;i++) { printf("%c",str[i]); if(str[i]==max) { printf("(max)"); } } printf("\n"); } return 0; }
本文解析了HDU ACM竞赛中编号为2025的简单字符串处理题目,并提供了完整的C语言代码实现。该题要求找出输入字符串中的最大字符并在输出时标识出来。
1672

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



