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
import math | |
n, k = map(int, input().split()) | |
i = 2 | |
cnt = 0 | |
while n > 1: | |
if n % i == 0: | |
cnt += 1 | |
if cnt == k: | |
print(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
import math | |
n = int(input()) | |
flag = True | |
while n > 0: | |
m = n % 10 | |
if m != 0 and m != 6 and m != 8: | |
flag = False | |
break |
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
import math | |
n = int(input()) | |
cnt = 0 | |
for i in range(1, int(math.sqrt(n)+1)): | |
if n % i == 0: | |
cnt += 1 | |
if n // i != i: | |
cnt += 1 | |
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
import math | |
n = int(input()) | |
cnt = 0 | |
for i in range(1, int(math.sqrt(n)+1)): | |
if n % i == 0: | |
cnt += 1 | |
if n // i != i: | |
cnt += 1 | |
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 t; cin >> t; | |
if (t <= 50) | |
{ | |
cout << 25000 + 600 * t << endl; | |
} | |
else if (t <= 200) |
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 a, b, c; | |
cin >> a >> b >> c; | |
if (a + b > c && b + c > a && c + a > b) | |
{ | |
// không được phép viết a == b == c | |
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> | |
#define ll long long | |
using namespace std; | |
int main() | |
{ | |
string s; | |
cin >> s; | |
int n = s.length(); | |
int left = 0, right = n-1; |
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, mod = map(int, input().split()) | |
a = list(map(int, input().split())) | |
dem = {} | |
for x in a: | |
du = x % mod | |
dem[du] = dem.get(du, 0) + 1 | |
ans = 0 | |
for f in dem.values(): | |
ans += f * (f - 1) // 2 | |
print(ans) |
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 = int(input()) | |
a = list(map(int, input().split())) | |
freq = {} | |
count = 0 | |
for i in range(n): | |
key = a[i] - (i+1) | |
freq[key] = freq.get(key, 0) + 1 | |
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()) | |
arr = list() | |
h = [0] * 10000 | |
cnt = 0 | |
for i in range(n): | |
x = int(input()) | |
y = x - k | |
cnt += h[y] | |
h[x] += 1 |
NewerOlder