UVaLive 7270 Osu! Master (统计)
统计 Master UVALive
2023-09-11 14:17:18 时间
题意:给定 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; }
相关文章
- 报错:关闭HBase时无法找到Master:no hbase master found(完美解决)
- pm2.5检测统计
- 基于ACCESS和ASP的SQL多个表查询与计算统计代码(一)
- Google Earth Engine——植被统计数据集中的图像包含用于计算NTT的 “反转校正t统计“,NTT是由MODIS NDVI得出的植被颜色指数,FORMA用来测量褐化。
- 第十六届全国大学生智能车竞赛报名信息统计
- linux ls统计文件个数
- Excel 数据透视表小技巧之 02 如何统计唯一值数量 (教程含数据和解决方案)
- 大数据学习——SparkStreaming整合Kafka完成网站点击流实时统计
- 使用 GROUP BY WITH ROLLUP 改善统计性能
- 3.2.4. 计量资料的统计描述
- 2015年全球半导体产能统计:三星称霸,GF逆袭Intel
- hdu 1251 统计难题 (字典树)
- CAD如何统计各类数据?CAD图块/文字/面积统计教程