每日一题洛谷P10899 [蓝桥杯 2024 省 C] 劲舞团c++

https://www.luogu.com.cn/fe/api/problem/downloadAttachment/jhqdki17

cpp 复制代码
#include<iostream>
#include<vector>
using namespace std;
int main() {
	char S, A;
	unsigned long long T;
	vector<char> s;
	vector<char> a;
	vector<unsigned long long> t;
	while (cin >> S >> A >> T) {
		s.push_back(S);
		a.push_back(A);
		t.push_back(T);
	}
	int maxc = 0;
	int sum = 1;
	for (int i = 1; i < s.size(); i++) {
		if (s[i] == a[i] && (t[i] - t[i - 1]) <= 1000) {
			sum++;
		}
		else {
			if (sum > maxc)maxc = sum;
			sum = 1;
		}
	}
	if (sum > maxc)maxc = sum;
	cout << maxc << endl;
	return 0;
}
相关推荐
Lenyiin1 分钟前
02.05、链表求和
数据结构·c++·算法·leetcode·链表
几何心凉2 分钟前
从全密态到AI运维:openGauss构建企业级数据安全与效率的双重屏障
开发语言·数据库
思茂信息1 小时前
CST软件对Customer Success OPPO手机电源适配器EMC仿真
开发语言·嵌入式硬件·matlab·3d·智能手机·cst
缺点内向2 小时前
如何在 C# 中将 Excel 工作表拆分为多个窗格
开发语言·c#·.net·excel
少废话h3 小时前
解决Flink中ApacheCommonsCLI版本冲突
开发语言·python·pycharm
天命码喽c3 小时前
GraphRAG-2.7.0整合Milvus-2.5.1
开发语言·python·milvus·graphrag
后端小张3 小时前
【JAVA进阶】Spring Boot 核心知识点之自动配置:原理与实战
java·开发语言·spring boot·后端·spring·spring cloud·自动配置
Mr_Xuhhh8 小时前
YAML相关
开发语言·python
阿巴~阿巴~8 小时前
JsonCpp:C++ JSON处理利器
linux·网络·c++·json·tcp·序列化和反序列化
咖啡の猫8 小时前
Python中的变量与数据类型
开发语言·python