HDULive 7270

来源:互联网 发布:中科大网络教学平台 编辑:程序博客网 时间:2024/06/06 12:37

题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5282

题意:读懂题后是一道超水超水的题。求分别以c 1开头,t 1开头的连续序列以及s的个数。代码如下,不知该怎么解释好了,最初错了易读错题意了。

#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>using namespace std;int main(){    int n;    while(~scanf("%d",&n))    {        int ans=0;        while(n--)        {            char c;            cin>>c;            if(c=='S')            {                ans++;            }            else            {                int t;                cin>>t;                if(t==1) ans++;            }        }cout<<ans<<endl;    }}


0 0
原创粉丝点击