码迷,mamicode.com
首页 > 其他好文 > 详细

LA 7270 Osu! Master (统计)

时间:2016-08-08 12:28:21      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:

题意:给定 n 个元素,有的有一个值,如果是 S 那么是单独一个,其他的是一个,求从 1 开始的递增的数量是多少。

析:那么S 是单独的,要统计上,既然是从 1 开始递增的,那么再统计 1 的数量即可。

代码如下:

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
using namespace std ;

typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 3e5 + 5;
const int mod = 1e9 + 7;
const int dr[] = {0, 0, -1, 1};
const int dc[] = {-1, 1, 0, 0};
int n, m;
inline bool is_in(int r, int c){
    return r >= 0 && r < n && c >= 0 && c < m;
}
char s[10];

int main(){
    int n;
    while(cin >> n){
        int ans = 0;
        for(int i = 0; i < n; ++i){
            cin >> s;
            if(s[0] == ‘S‘) ++ans;
            else{
                cin >> m;
                if(1 == m)  ++ans;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

 

LA 7270 Osu! Master (统计)

标签:

原文地址:http://www.cnblogs.com/dwtfukgv/p/5748601.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!