U E D R , A S I H C RSS

Light More Light/허아영

LightMoreLight/허아영

2006-02-11 Time Limit Exceeded 10.051 440

ㅋㅋ for 때문에 시간이 걸리네.ㅠ
ㅁㅣ완성 ~ ㅋㅋ

수식을 만들어야겠다 ㅋㅂ

1. before..
As problem,
equally I do.

2. different idea..
simply,, I thinked..
If the Number of n's measure is an odd number, an answer is "No"
else if the Number of n's measure is an even number, an answer is "Yes".

How do I code this contents??

I learned how to solve the Number of n's measure.. at a middle school.
6 = 2^1 * 3^1
(index+1)s multiplication -> 2 * 2 = 4
6's measure are 1, 2, 3, 6
total 4!!!

코드

~cpp 
#include <iostream>
using namespace std;

int process(int n)
{
	int i = 0, j = 0;
	int state = 0;

	for(i = 1; i <= n; i++)			// n 번 왕복,
	{
		if(n % i == 0)
			state = ~state;
	}	
	return state; // 마지막 
}

int main()
{
	int n;
	int result = 0;
	while(1)
	{
		cin >> n;
		if(n == 0)
			break;
		result = process(n);
		if(result == 0)
			cout << "no" << endl;
		else
			cout << "yes" << endl;
	}
	return 0;
}


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:38
Processing time 0.0098 sec