标签:
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