백준 algorithm

백준 2753 - 윤년

cosmohoo 2019. 9. 3. 00:26
반응형

문제 설명

if 문을 통해 판별해주는 간단한 코드문이었다. 

 

#include <iostream>
using namespace std;

int main()
{
	int year;
	cin >> year;
	if (year % 4 == 0)
	{
		if (year % 100 != 0) cout << 1;
		else if (year % 400 == 0) cout << 1;
		else cout << 0;
	}
	else cout << 0;
	return 0;
}
반응형