Created
September 15, 2018 06:21
-
-
Save completejavascript/efec8f74182d70db11609b8b9baa0a99 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
typedef unsigned long long ull; | |
int main() | |
{ | |
//freopen("input.txt","r",stdin); | |
ull n = 0; | |
cin >> n; | |
bool checkStop = true; | |
while(true) | |
{ | |
if(n <= 2) break; | |
// Nếu số n có một ước số > 2 mà lẻ thì chắc chắn | |
// ở trong vòng lặp đề bài n = 3*n + 3 , n sẽ tăng | |
// do đó vòng lặp đó sẽ không bao giờ dừng | |
if(n > 2 && n%2 != 0) | |
{ | |
checkStop = false; | |
break; | |
} | |
n = n/2; | |
} | |
if(checkStop) cout << "TAK" << endl; | |
else cout << "NIE" << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment