项目流程管理软件郑州网络seo
思路和时间复杂度
- 思路:签到模拟题,但是思路也很重要,在K的重新赋值时,卡了一下,在不满足时间条件时,应该重置为1
- 时间复杂度:
代码
#include <iostream>
#include<cmath>
using namespace std;
int main()
{// 请在此输入您的代码char x, y;long long t;int maxK = 0;int K = 0;long long preT = -1;while(cin>>x>>y>>t){if(x != y){K = 0;preT = t;continue;}if(preT == -1){K = 1;}else{if(t - preT <= 1000){K++;}else{K = 1;}}maxK = max(maxK, K);preT = t;}cout<<maxK;return 0;
}