코딩공부/Softeer

[Softeer/C++] [한양대 HCPC 2023] Hanyang Popularity Exceeding Competition

usingsystem 2024. 11. 5. 16:04
728x90

https://softeer.ai/practice/9495

 

Softeer - 현대자동차그룹 SW인재확보플랫폼

 

softeer.ai

소스코드

#include<iostream>
#include<vector>
using namespace std;

int main(int argc, char** argv)
{
	int n;
	int pi, ci;

	cin >> n;
	
	int answer = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> pi >> ci;

		if (abs(answer - pi) <= ci)
			answer++;
	}

	std::cout << answer;
}
728x90