Skip to content

Instantly share code, notes, and snippets.

@completejavascript
Created September 15, 2018 06:21
Show Gist options
  • Save completejavascript/efec8f74182d70db11609b8b9baa0a99 to your computer and use it in GitHub Desktop.
Save completejavascript/efec8f74182d70db11609b8b9baa0a99 to your computer and use it in GitHub Desktop.
#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