Guess my rank is gonna plummet again
This commit is contained in:
parent
477c426b55
commit
86fd670f4d
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python3
|
||||
for _ in range(int(input())):
|
||||
n, d = input().split()
|
||||
n, d = [int(x) for x in n], int(d)
|
||||
for i in range(-1, -1-len(n), -1):
|
||||
if n[i] > d:
|
||||
n[i] = d
|
||||
else:
|
||||
break
|
||||
for i in range(i, -len(n), -1):
|
||||
if n[i] < n[i-1]:
|
||||
n.pop(i - 1)
|
||||
n.append(d)
|
||||
print(''.join(map(str, n)))
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
from collections import Counter
|
||||
|
||||
for _ in range(int(input())):
|
||||
input()
|
||||
sizes = Counter(z // abs(z) for z in map(int, input().split())).values()
|
||||
print(max(sizes), min(sizes))
|
|
@ -0,0 +1,33 @@
|
|||
#include <stdio.h>
|
||||
|
||||
const char VOWELS[] = {97, 101, 105, 111, 117};
|
||||
|
||||
int main()
|
||||
{
|
||||
char *c, s[1001];
|
||||
long t, n, i, j, tmp;
|
||||
|
||||
scanf("%ld", &t);
|
||||
while (t--) {
|
||||
long vowels[32] = {};
|
||||
|
||||
scanf("%ld", &n);
|
||||
for (i = 0; i < n; ++i) {
|
||||
tmp = 0;
|
||||
scanf("%s", &s);
|
||||
for (c = s; *c; ++c) {
|
||||
for (j = 0; VOWELS[j] ^ *c; ++j);
|
||||
tmp |= 1 << j;
|
||||
}
|
||||
++vowels[tmp];
|
||||
}
|
||||
|
||||
tmp = vowels[31] * (vowels[31] - 1) / 2;
|
||||
for (i = 0; i < 31; ++i)
|
||||
for (j = i + 1; j < 32; ++j)
|
||||
tmp += ((i | j) == 31) * vowels[i] * vowels[j];
|
||||
printf("%ld\n", tmp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
from itertools import combinations
|
||||
|
||||
for _ in range(int(input())):
|
||||
print(sum(len(a | b) == 5 for a, b in combinations(
|
||||
(set(input()) for d in range(int(input()))), 2)))
|
Loading…
Reference in New Issue