1
0
Fork 0

I'm so burnt out rn

This commit is contained in:
Nguyễn Gia Phong 2020-01-13 16:29:31 +07:00
parent 0887d8f969
commit 65b8ebda4c
3 changed files with 54 additions and 0 deletions

14
codechef/brkbks.lua Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env lua
local read = io.read
local print = print
for t = 1, read('*n') do
local s, w1, w2, w3 = read('*n', '*n', '*n', '*n')
if w1 + w2 + w3 <= s then
print(1)
elseif w1 + w2 <= s or w2 + w3 <= s then
print(2)
else
print(3)
end
end

33
codechef/chfdora.c Normal file
View File

@ -0,0 +1,33 @@
#include <stdio.h>
int min(int a, int b)
{
return (a < b) ? a : b;
}
int main()
{
int t, n, m;
scanf("%d", &t);
while (t--) {
scanf("%d %d", &n, &m);
size_t a[n][m];
for (int i = 0; i < n; ++i)
for (int j = 0; j < m; ++j)
scanf("%zu", a[i] + j);
size_t count = 0;
for (int i = 0; i < n; ++i)
for (int j = 0; j < m; ++j) {
int max = min(min(i, j), min(n-i, m-j)-1);
for (int k = 0;
k <= max && a[i+k][j] == a[i-k][j]
&& a[i][j+k] == a[i][j-k];
count++, ++k);
}
printf("%zu\n", count);
}
return 0;
}

7
codechef/dynamo.py Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env python
for t in range(int(input())):
n = 10 ** int(input())
print(n*2 + int(input()), flush=True)
print(n - int(input()), flush=True)
print(n - int(input()), flush=True)
input()