当前位置:网站首页>Record Breaker (Google Kickstart2020 Round D Problem A)
Record Breaker (Google Kickstart2020 Round D Problem A)
2022-07-30 06:05:00 【Zhang Xueheng】
1:题目
Isyana Got its local theme park in a row N the number of tourists per day.
其中第 i The number of visitors for the day is Vi.
If one day can meet the following two conditions at the same time,The day is considered a record-breaking day:
The number of tourists on this day is strictly greater than the number of tourists on each previous day.
这是最后一天,Or the number of tourists on one day is strictly greater than the number of tourists on the next day.
请注意,The first day can also be a record-breaking day.
请帮助 Isyana Find out the record-breaking days.
输入格式
第一行包含整数 T,表示共有 T 组测试数据.
每组数据第一行包含整数 N.
第二行包含 N 个整数,其中第 i 个表示 Vi.
输出格式
每组数据输出一个结果,每个结果占一行.
结果表示为 Case #x: y,其中 x 为组别编号(从 1 开始),y for record-breaking days.
数据范围
1≤T≤100,
0≤Vi≤2×105,
对于每个测试点,满足 1≤N≤2×105 的数据一定不超过 10 组,其余数据则满足 1≤N≤1000.
输入样例:
4
8
1 2 0 7 2 0 2 0
6
4 8 15 16 23 42
9
3 1 4 1 5 9 2 6 5
6
9 9 9 9 9 9
输出样例:
Case #1: 2
Case #2: 1
Case #3: 3
Case #4: 0
样例解释
For test samples 1,Records were broken on the second and fourth days.
For test samples 2,Only the last day broke the record.
For test samples 3,第一天、The third and sixth days broke records.
For test samples 4,Not a single day broke the record.
难度:简单
时/空限制:1s / 64MB
总通过数:26
总尝试数:36
来源:Google Kickstart2020 Round D Problem A
算法标签
None
2:代码实现
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 200010;
int n, st[N];
int main()
{
int T;
cin >> T;
for(int t = 1; t <= T; t++){
cin >> n;
for(int i = 0; i < n; i++) cin >> st[i];
int res = 0, mav = 0;
for(int i = 0; i < n; i++)
if(mav < st[i]){
mav = st[i];
if(st[i] > st[i + 1]) res++;
}
cout << "Case #" << t << ": " << res << endl;
}
return 0;
}
边栏推荐
- 【小程序项目开发 -- 京东商城】uni-app 商品分类页面(下)
- MySQL-Explain详解
- 【Koltin Flow(二)】Flow操作符之末端操作符
- How is crawler data collected and organized?
- cmd(命令行)操作或连接mysql数据库,以及创建数据库与表
- 程序员大保健指南,给自己的身心偶尔放松的机会
- 从底层结构开始学习FPGA(6)----分布式RAM(DRAM,Distributed RAM)
- Summary of SQL classic interview questions in 2022 (with analysis)
- 分布式事务之 Seata框架的原理和实战使用(三)
- Path dependence: the poor hard science to counter attack breakthrough
猜你喜欢
mysql basics (4)
[Mysql] DATEDIFF function
如何使用FirewallD限制网络访问
MySQL stored procedure
Programmers make money and practice, teach you how to do paid courses, self-media, paid articles and paid technical courses to make money
手把手教你设计一个CSDN系统
号称年薪30万占比最多的专业,你知道是啥嘛?
JVM之GC 调优基础知识(一)
图形镜像对称(示意图)
2022 Pengcheng Cup web
随机推荐
MySQL索引从入门到深入学习
如何使用FirewallD限制网络访问
net start mysql MySQL service is starting. MySQL service failed to start.The service did not report any errors.
文档在线化管理系统Confluce使用
[Mysql] DATEDIFF函数
[GO语言基础] 一.为什么我要学习Golang以及GO语言入门普及
[Image detection] Research on cumulative weighted edge detection method based on grayscale image with matlab code
手把手教你彻底卸载MySQL
图形镜像对称(示意图)
2022年SQL经典面试题总结(带解析)
参与开源,让程序员找回热血和激情
[Koltin Flow (2)] The end operator of the Flow operator
mysql 中 in 的用法
Within the SQL connection table (link connections, left or right, cross connection, full outer join)
个人博客系统(附源码)
从想当亿万富翁到职场、创业、爱情、抑郁、学医学武,我的程序人生
How is crawler data collected and organized?
腾讯面试居然跟我扯了半小时的CountDownLatch
More fragrant open source projects than Ruoyi in 2022
asyncawait和promise的区别