chaper3_exercise_Uva1585_score
Posted 豆子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了chaper3_exercise_Uva1585_score相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章