码迷,mamicode.com
首页 > 其他好文 > 详细

hdu 2561~2566 水题集合

时间:2015-04-22 00:26:38      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

2561:

 1 #include <iostream>
 2 #include <cstring>
 3 using namespace std;
 4 
 5 const int N = 10;
 6 int num[N];
 7 
 8 int main()
 9 {
10     int t;
11     cin >> t;
12     while ( t-- )
13     {
14         int n;
15         cin >> n;
16         for ( int i = 0; i < n; i++ )
17         {
18             cin >> num[i];
19         }
20         int tmp = 0;
21         for ( int i = 1; i < n; i++ )
22         {
23             if ( num[tmp] > num[i] ) tmp = i;
24         }
25         num[tmp] = 100;
26         tmp = 0;
27         for ( int i = 1; i < n; i++ )
28         {
29             if ( num[tmp] > num[i] ) tmp = i;
30         }
31         cout << num[tmp] << endl;
32     }
33     return 0;
34 }

2562:

 1 #include <iostream>
 2 #include <cstring>
 3 using namespace std;
 4 
 5 const int N = 51;
 6 char num[N];
 7 
 8 int main()
 9 {
10     int t;
11     cin >> t;
12     while ( t-- )
13     {
14         cin >> num;
15         int len = strlen(num);
16         for ( int i = 0; i < len - 1; i += 2 )
17         {
18             swap( num[i], num[i + 1] );
19         }
20         cout << num << endl;
21     }
22     return 0;
23 }

2563:

 

2564:

 1 #include <cstring>
 2 #include <cstdio>
 3 #include <cctype>
 4 using namespace std;
 5 
 6 const int N = 101;
 7 char word[N];
 8 
 9 int main ()
10 {
11     int t;
12     scanf("%d", &t);
13     getchar();
14     while ( t-- )
15     {
16         gets(word);
17         int len = strlen(word);
18         for ( int i = 0; i < len; i++ )
19         {
20             if ( isalpha(word[i]) )
21             {
22                 char ch = toupper(word[i]);
23                 printf("%c", ch);
24                 do
25                 {
26                     i++;
27                 } while ( isalpha(word[i]) );
28             }
29         }
30         puts("");
31     }
32     return 0;
33 }

2565:

 

2566:

hdu 2561~2566 水题集合

标签:

原文地址:http://www.cnblogs.com/huoxiayu/p/4445700.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!