코딩공부/Softeer

[Softeer/C++]Level1 [한양대 HCPC 2023] Tren del Fin del Mundo

usingsystem 2024. 3. 7. 22:23
728x90

https://softeer.ai/practice/7695

 

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

 

softeer.ai

틀렸는데 피드백좀해주세요 ㅠ

소스코드


#include<iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

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

	cin >> n;
	cin.ignore();

	string maxStr;
	int max = 0;
	for (int i = 0; i < n; i++)
	{
		int a;
		int b;

		cin >> a >> b;

		int result = abs(a - b);

		if (max < result)
		{
			max = result;
			maxStr = to_string(a)+" "+ to_string(b);
		}
	}
	cout << maxStr;
	return 0;
}
728x90