您的位置:首页 > 其它

算法竞赛入门经典3.1 得分UVa1585

2016-07-27 21:05 351 查看
#include <iostream> 
#include <string>
using namespace std;
   
int main()
{  int  n;  
 cout<<"please input the number"<<endl;
 cin>>n;
 while (n--)  
    {  
int m = 0, t = 0, i = 0;
   string s;
   cout<<"please input the string"<<endl;
    cin>>s;
 while (i <= s.length() - 1)  
        {  
            if (s[i] == 'X') m = 0;  
            else  
            {  
                m++;  
                t += m;  
            }  
            i++;  
        }  
       
cout<<t<<endl;
  }  
    return 0; 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: