HDOJ2025 ( 查找最大元素 )【水题】

Problem : 2025 ( 查找最大元素 )     Judge Status : Accepted
RunId : 6000694    Language : C    Author : qq1203456195
Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta
 1 #include <stdio.h>
 2 int main()
 3 {
 4     int i,max;
 5     char str[101];
 6     while (scanf("%s",str)!=EOF)
 7     {
 8         i=0;
 9         max=-1;
10         while(str[i]!='\0')
11         {
12             max=max>str[i]?max:str[i];
13             i++;
14         }
15         i=0;
16         while (str[i]!='\0')
17         {
18             printf("%c",str[i]);
19             if(str[i]==max)    printf("(max)");
20             i++;
21         }
22         printf("\n");
23 
24     }
25     return 0;
26 }

 

posted @ 2012-05-26 09:31  ZH奶酪  阅读(1419)  评论(0编辑  收藏  举报