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
def is_prime(num): | |
if num < 2: | |
return False | |
for i in range(2, int(num**0.5) + 1): | |
if num % i == 0: | |
return False | |
return True | |
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
def isPrime(n): | |
if n < 2: | |
return False | |
for i in range(2, int(n**0.5) + 1): | |
if n % i == 0: | |
return False | |
return True | |
def beautifulNumber(n): | |
if n < 2: |
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
n, k = map(int, input().split()) | |
x = 2 | |
cnt = 0 | |
while n != 1: | |
if n % x == 0: | |
n = n // x | |
cnt += 1 | |
if cnt == k: | |
print(x) |
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
n, k = map(int, input().split()) | |
x = 2 | |
cnt = 0 | |
while n != 1: | |
if n % x == 0: | |
n = n // x | |
cnt += 1 | |
if cnt == k: | |
print(x) |
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 <bits/stdc++.h> | |
using namespace std; | |
const int N = 1e6 + 5; | |
int a[N]; | |
int gcd(int a, int b) | |
{ | |
while (a != 0 && b != 0) | |
{ | |
if (a > b) |
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 <bits/stdc++.h> | |
using namespace std; | |
long long M = 1000000007; | |
int main() { | |
int N; | |
cin >> N; | |
long long A[1000005]; | |
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 <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
int N; | |
cin >> N; | |
int A[1000000]; | |
for (int i = 0; i < N; i++) { | |
cin >> A[i]; |
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 <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
int x, y; // khai bao 2 bien x, y | |
cin >> x >> y; // nhap 2 bien x, y | |
cout << y / x << endl; | |
cout << fixed << setprecision(2) << (float)y / x << endl; // in do chinh xac 2 so dang sau dau phay | |
return 0; |
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 <bits/stdc++.h> | |
using namespace std; | |
const int N = 2000; | |
int arr[N]; | |
int getSum(int x) | |
{ | |
int sum = 0; | |
for (int i = 0; i <= x; i++) | |
{ |
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 <bits/stdc++.h> | |
using namespace std; | |
const int N = 2000; | |
int arr[N]; | |
int h[N] = {0}; | |
int main() { | |
// 1 1 2 2 3 | |
int n; cin >> n; | |
for (int i = 0; i < n; i++) |