[C++] 백준 2단계

알감자·2022년 2월 23일
0

백준알고리즘

목록 보기
1/52

#1330

#include <iostream>
using namespace std;

int main() 
{
	int A, B;
	cin >> A >> B;

	if (A > B) 
	{
		cout << ">";
	}
	else if (A < B)
	{
		cout << "<";
	}
	else 
	{
		cout << "==";
	}

	return 0;
}

#9498

#include <iostream>
using namespace std;

int main() 
{
	int A;
	cin >> A;

	if (A < 0 || A>100)
		return 0;

	if (A >= 90 && A<=100) 
	{
		cout << "A";
	}
	else if (A >=80 && A <90)
	{
		cout << "B";
	}
	else if(A >=70 && A<80)
	{
		cout << "C";
	}
	else if (A >= 60 && A < 70) 
	{
		cout << "D";
	}
	else 
	{
		cout << "F";
	}
}

#2753

#include <iostream>
using namespace std;


int main() 
{
	int A;
	cin >> A;

	if (A < 1 || A>4000)
		return 0;

	if (A%4 == 0) 
	{
		if (A % 100 == 0) 
		{
			if (A % 400 == 0) 
			{
				cout << "1";
			}
			else
			{
				cout << "0";
			}
		}
		else 
		{
			cout << "1";
		}	
	}
	else 
	{
		cout << "0";
	}
}

#2884

#include <iostream>
using namespace std;


int main() 
{
	int H, M;
	cin >> H >> M;

	if (H < 0 || H >23 || M <0 || M>59)
		return 0;

	M = M - 45;

	if (M < 0) 
	{
		H = H - 1;

		if (H < 0) 
		{
			H = 23;
		}

		M = M + 60;
	}

	cout << H << " " <<M;
}

#2525

#include <iostream>
using namespace std;


int main() 
{
	int A, B;
	cin >> A >> B;

	int c;
	cin >> c;

	if (A < 0 || A >23)
		return 0;

	if (B < 0 || B>59)
		return 0;

	if (c < 0 || c>1000)
		return 0;

	B = B + c;

	if (B >= 60) 
	{

		A = A + (B / 60);

		if (A >= 24) 
		{
			A = A % 24;
		}
		
		B = B % 60;
	}

	cout << A << " " <<B;
}

0개의 댓글