U E D R , A S I H C RSS

코드레이스/2007.03.24상섭수생형진

#include <iostream>

using namespace std;

bool getColor(int sec)
{
	if (sec%150 < 120)
		return false;
	return true;
}

void main(){

	int sec;

	cin >> sec;

	cout << ((getColor(sec))? "green" : "red") << endl ;
}


#include <iostream>

using namespace std;

bool getColor(int sec)
{
	if (sec%150 < 120)
		return false;
	return true;
}


int getSec(int Y, int m, int d, int H, int i, int s)
{
	Y = Y-2000;
	m = m-1;
	d = d-1;

	return ((((Y * 12 + m) * 30 + d) * 24 + H) * 60 + i) * 60 + s;
}


void main(){

	int year, month, day, hour, min, sec;


	cin >> year >> month >> day >> hour >> min >> sec;

	sec = getSec(year, month, day, hour, min, sec);

	cout << sec << "초" << endl << ((getColor(sec))? "green" : "red") << endl ;
}


#include <iostream>

using namespace std;

bool getColor(int sec)
{
	if (sec%150 < 120)
		return false;
	return true;
}


int getSec(int Y, int m, int d, int H, int i, int s)
{
	Y = Y-2000;
	m = m-1;
	d = d-1;

	return ((((Y * 12 + m) * 30 + d) * 24 + H) * 60 + i) * 60 + s;
}


void main(){

	int num, year, month, day, hour, min, sec, cnt = 0;

	cin >> num;

	for(int i=0; i<num; i++)
	{
		cin >> year >> month >> day >> hour >> min >> sec;
		sec = getSec(year, month, day, hour, min, sec);
		cnt += (getColor(sec) ? 0 : 1);
	}

	cout << cnt << "명이 신호위반" << endl ;
}


#include <iostream>

using namespace std;

int getColor(int sec)
{
	if (sec%155 < 120)
		return 0;
	else if (sec%155 < 125)
		return -1;
	return 1;
}


int getSec(int Y, int m, int d, int H, int i, int s)
{
	Y = Y-2000;
	m = m-1;
	d = d-1;

	return ((((Y * 12 + m) * 30 + d) * 24 + H) * 60 + i) * 60 + s;
}


void main(){

	int num, year, month, day, hour, min, sec, cnt = 0;

	cin >> num;

	for(int i=0; i<num; i++)
	{
		cin >> year >> month >> day >> hour >> min >> sec;
		sec = getSec(year, month, day, hour, min, sec);
		cnt += (getColor(sec) ? 0 : 1);
	}

	cout << cnt << "명이 신호위반" << endl ;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:18
Processing time 0.0153 sec