LightMoreLight/허아영 ¶
2006-02-11 Time Limit Exceeded 10.051 440 |
ㅁㅣ완성 ~ ㅋㅋ
As problem,
equally I do.
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".
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; }