Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

시간맞추기/조현태

From ZeroWiki

소 감

..문제는 별로 어렵지 않았다. time이녀석이야 평소에도 쓰니까.. 그런데.. 도데체 왜 for를 쓰라고 했는지..ㅠ.ㅜ while도 아니고.. 뭔가 for를 for답게 뽀대나게 만들어 줄려고 하다보니 길어졌다.^^;;; 그리고 문제에 오차율이 빠져있었다. 얼마나 정확하게 하라는건지..1/1000초는 아닐테지?? 1/100인가?? 본인은 귀차니즘으로 그냥 1초.ㅎㅎ 8-9초사이에 눌러주기만 하면 된다.^^

소스

#include <iostream>
#include <time.h>
#include <conio.h>
using namespace std;

const int ANSWER_TIME=8;

void main()
{
	int second;
	time_t before_time;
	before_time=time(&before_time);
	for (second=0; !kbhit(); ++second)
	{
		time_t now_time;
		time(&now_time);
		while(now_time==before_time)
		{
			time(&now_time);
		}
		time(&before_time);
	}
	if (second==ANSWER_TIME-1)
		cout << "you win!!!";
	else
		cout << "your time is off." << second;
	system("PAUSE");
}

나한테 할 말


시간맞추기 LittleAOI