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] * 10 | |
cnt = 0 | |
for i in range(n): | |
x = int(input()) | |
y = x - k | |
cnt += h[y] | |
h[x] += 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
s = input().strip() | |
h = [0] * 26 | |
for ch in s: | |
h[ord(ch) - ord('a')] += 1 | |
print(*h) |
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()) | |
arr = list(map(int, input().split())) | |
left = 0 # vi tri dau | |
right = n-1 | |
flag = True | |
while left < right: | |
if arr[left] != arr[right]: | |
flag = False |
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(){ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
cout.tie(0); | |
int n, k; | |
cin >> n >> k; | |
int a[n]; |
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() { | |
string str; | |
cin >> str; | |
// abc -> abccba | |
// abcd -> abcddcba | |
for (int i = 0; i < str.length(); 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() { | |
string str; | |
cin >> str; | |
for (int i = 0; i < str.length(); i++) | |
{ | |
cout << str[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 <cmath> | |
#include <cstdio> | |
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
int main() { | |
string str; |
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
#include <bits/stdc++.h> | |
#define ll long long | |
using namespace std; | |
int main() | |
{ | |
// "nguyen thi kim anh" | |
// chữ cái đầu tiên luôn luôn viết hóa | |
// sau dấu cách thì luôn luôn viết hoa | |
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
# hàm | |
#Liệt kê những số là số nguyên tố nhỏ hơn N và có tổng các chữ số của nó là một số trong dãy số Fibonacci. | |
import math | |
def isFibonacci(n): | |
# pass | |
x1 = 1 | |
x2 = 1 | |
while x2 < n: | |
temp = x1 | |
x1 = x2 |