Test instructions: Given n elements, some have a value, if it is S then is a single, the other is a, the number of increments starting from 1 is how much.
Analysis: Then S is separate, to statistics, since it is starting from 1 increments, then the number of statistics 1 can be.
The code is as follows:
#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 = 0x3f3f3f3 F3f3f;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 (statistics)