zoukankan      html  css  js  c++  java
  • 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 }
  • 相关阅读:
    客户端加锁
    三次握手
    ForkJoinTask
    主从Reactor多线程模型
    Happen-before
    Enum
    Java 8
    Netty
    分布式一致性算法
    VisualStudio 2013 快捷键
  • 原文地址:https://www.cnblogs.com/douzujun/p/5584865.html
Copyright © 2011-2022 走看看