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

chaper3_exercise_Uva1585_score

时间:2016-06-14 19:25:06      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:

 1 #include<iostream>
 2 #include<string>
 3 using namespace std;
 4 
 5 int main(void)
 6 {
 7     int *count, T, k = 0, j = 0;
 8     string c;
 9     cin >> T;
10     count = new int[T];
11     if (!count)
12     {
13         return 1;
14     }
15     for (int i = 0; i < T; i++)
16     {
17         count[i] = 0;
18     }
19     for (int i = 0; i < T; i++)
20     {
21         cin >> c;
22         k = 0;
23         for (int b = 0; b != c.size(); b++)
24         {
25             if (c[b] == O)
26             {
27                 k++;
28                 count[i] = count[i] + k;
29             }
30             if (c[b] == X)
31             {
32                 k = 0;
33             }
34         }
35     }
36     for (int i = 0; i < T; i++)
37         cout << count[i] << endl;
38     delete []count;
39     return 0;
40 }

 

chaper3_exercise_Uva1585_score

标签:

原文地址:http://www.cnblogs.com/douzujun/p/5584865.html

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