Compare commits

..

2 Commits

Author SHA1 Message Date
28a6b807a3 Merge branch 'main' of dumtaxat-git:boyan_k/coding_practice 2023-12-01 13:24:24 +01:00
800ace7a75 gitifyed 2023-12-01 13:22:00 +01:00
7 changed files with 1129 additions and 0 deletions

10
AoC/2022/7/1.py Executable file
View File

@ -0,0 +1,10 @@
#!/bin/python
"""
Description:
"""
if __name__ == "__main__":
main()

1000
AoC/2023/trebuchet/input.in Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
char c;
int sum = 0;
int first = -1, last = -1;
while ((c = getchar()) != EOF) {
if (c == '\n') {
sum += last != -1 ? first*10 + last : first*10 + first;
first = -1;
last = -1;
} else {
if (c <= '9' && c >= '0') {
if (first == -1) {
first = c - '0';
} else {
last = c - '0';
}
}
}
}
printf("%d\n", sum);
return 0;
}

View File

@ -0,0 +1,32 @@
def findFirstAndLastInt(inp):
first = 0
last = 0
for i in inp:
if i.isdigit():
if first == 0:
first = i
else:
last = i
if last == 0:
last = first
return int(first), int(last)
def main():
inputs = []
with open("input.in", "r") as f:
for line in f:
inputs.append(line.strip())
s = 0
for inp in inputs:
first, last = findFirstAndLastInt(inp)
s += first*10 + last
print(s)
if __name__ == "__main__":
main()

16
codeforces/1822A/1.in Executable file
View File

@ -0,0 +1,16 @@
5
5 9
1 5 7 6 6
3 4 7 1 9
4 4
4 3 3 2
1 2 3 4
5 7
5 5 5 5 5
2 1 3 9 7
4 33
54 71 69 96
42 24 99 1
2 179
55 66
77 88

26
codeforces/1822A/Main.java Executable file
View File

@ -0,0 +1,26 @@
public class Main {
public static void main(String[] args) {
// Take integer as input from stdin
int q = new java.util.Scanner(System.in).nextInt();
// Loop through the input
for (int i = 0; i < q; i++) {
// Take 2 integers as input from stdin
int n = new java.util.Scanner(System.in).nextInt();
int t = new java.util.Scanner(System.in).nextInt();
// Create array and append input from stdin until newline
int[] a = new java.util.Scanner(System.in).useDelimiter("\\n").next().chars().toArray();
// Create array and append input from stdin until newline
int[] b = new java.util.Scanner(System.in).useDelimiter("\\n").next().chars().toArray();
// Print the arrays a and b
System.out.println(a);
return;
}
}
}

17
codeforces/1822A/main.py Executable file
View File

@ -0,0 +1,17 @@
# Codeforces Round #182 (Div. 2)
# Problem A
# URL: https://codeforces.com/problemset/problem/1822/A
def main():
cases = int(input())
for case in range(cases):
video, lunch = input().split()
videos_lengths = input().split()
entertainment = input().split()
print(video, lunch, videos_lengths, entertainment)
if __name__ == '__main__':
main()
# Path: 1822B/main.py