Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<vector>
- class RecentCounter
- {
- private:
- std::vector<int>count;
- public:
- RecentCounter()
- {
- }
- int ping (int t)
- {
- int recent = 0;
- count.push_back(t);
- for(size_t i = 0; i < count.size(); i++ )
- {
- if(t-count[i] <= 3000)
- {
- recent++;
- }
- }
- count.erase(count.begin(), count.end()-recent);
- return recent;
- }
- };
- int main()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment