added c03

This commit is contained in:
s153523 2025-02-03 01:16:03 +01:00
parent 773f8bbbb4
commit 7131194cf0
10 changed files with 11 additions and 155 deletions

View File

@ -1,36 +0,0 @@
Liczby podzielne przez 5
========================
Napisać program, który wczytuje kolejne wiersze ze standardowego
wejścia i analizuje każdy wiersz (bez znaku końca wiersza). Należy w
jak największym stopniu wykorzystać wyrażenia regularne (np. nie wolno
użyć negacji jako operacji w danym języku programowania, jeśli da się
to wyrazić w samym wyrażeniu regularnym). Tam, gdzie to możliwe należy
użyć pojedynczego wyrażenia regularnego.
Write a program, which loads consecutive lines from standard input
and analyze every line (with no newline character). You should
use regular expressions to the greatest extent possible (e.g. you
can not use negation in the programming language if it is
possible to express the same in regular expression). Wherever possible,
use one regular expression.
Dla każdego napisu należy sprawdzić, czy zadany napis jest liczbą całkowitą
podzielną przez 5. Napis nie powinien zawierać zer nieznaczących.
Jeśli napis spełnia tak określony warunek, należy wypisać na
standardowym wyjściu 'yes', w przeciwnym razie — 'no'.
For each string check, if the given string is an integer divisible by 5.
The string should not contain leading zeros.
If the string fulfills the condition, you should print 'yes' on the
standard output and 'no' otherwise.
UWAGA! Zadanie przeznaczone dla studentów, których numer indeksu
dzieli się przez 10 z resztą 0.
Attention. The task is for students whose students id remainder of the division by 10 is 0.
POINTS: 2
DEADLINE: 2025-01-10 23:59
REMAINDER: 0/10

View File

@ -1,10 +0,0 @@
yes
yes
no
yes
no
no
yes
no
yes
no

View File

@ -1,10 +0,0 @@
-1005
-50
-76
0
00
01000
1000
353
465
@!q

View File

@ -1,35 +0,0 @@
Liczby podzielne przez 25
=========================
Napisać program, który wczytuje kolejne wiersze ze standardowego
wejścia i analizuje każdy wiersz (bez znaku końca wiersza). Należy w
jak największym stopniu wykorzystać wyrażenia regularne (np. nie wolno
użyć negacji jako operacji w danym języku programowania, jeśli da się
to wyrazić w samym wyrażeniu regularnym). Tam, gdzie to możliwe należy
użyć pojedynczego wyrażenia regularnego.
Write a program, which loads consecutive lines from standard input
and analyze every line (with no newline character). You should
use regular expressions to the greatest extent possible (e.g. you
can not use negation in the programming language if it is
possible to express the same in regular expression). Wherever possible,
use one regular expression.
Dla każdego napisu należy sprawdzić, czy zadany napis jest dodatnią liczbą
podzielną przez 25.
Jeśli napis spełnia tak określony warunek, należy wypisać na
standardowym wyjściu 'yes', w przeciwnym razie — 'no'.
For each string check, if the given string is a positive integer divisible by 25.
If the string fulfills the condition, you should print 'yes' on the
standard output and 'no' otherwise.
UWAGA! Zadanie przeznaczone dla studentów, których numer indeksu
dzieli się przez 10 z resztą 1.
Attention. The task is for students whose students id remainder of the division by 10 is 1.
POINTS: 2
DEADLINE: 2025-01-10 23:59
REMAINDER: 1/10

View File

@ -1,8 +0,0 @@
no
yes
yes
yes
no
no
no
no

View File

@ -1,8 +0,0 @@
0
1000
111111125
25
353
465
@!q
x50

View File

@ -1,36 +0,0 @@
Kody pocztowe
=============
Napisać program, który wczytuje kolejne wiersze ze standardowego
wejścia i analizuje każdy wiersz (bez znaku końca wiersza). Należy w
jak największym stopniu wykorzystać wyrażenia regularne (np. nie wolno
użyć negacji jako operacji w danym języku programowania, jeśli da się
to wyrazić w samym wyrażeniu regularnym). Tam, gdzie to możliwe należy
użyć pojedynczego wyrażenia regularnego.
Write a program, which loads consecutive lines from standard input
and analyze every line (with no newline character). You should
use regular expressions to the greatest extent possible (e.g. you
can not use negation in the programming language if it is
possible to express the same in regular expression). Wherever possible,
use one regular expression.
Dla każdego napisu należy wydobyć z kodu pocztowego kod miasta (2 pierwsze
cyfry). Jeśli napis nie jest kodem pocztowym, należy wypisać "<NONE>".
Zakładamy, że kod pocztowy składa się z 2 cyfr, minusa i 3 cyfr. Jeśli
napis nie spełnia podanych warunków, należy wypisać "<NONE>".
For each string, extract the postal code of a city (2 first digits).
If the string is not a postal code, you should print "<NONE>".
We assume that the postal code consists of 2 digits, minus character, and 3 digits.
If the string doesn't fulfill the condition, you should print "<NONE>".
UWAGA! Zadanie przeznaczone dla studentów, których numer indeksu
dzieli się przez 10 z resztą 2.
Attention. The task is for students whose students id remainder of the division by 10 is 2.
POINTS: 2
DEADLINE: 2025-01-10 23:59
REMAINDER: 2/10

View File

@ -1,6 +0,0 @@
<NONE>
<NONE>
23
<NONE>
61
<NONE>

View File

@ -1,6 +0,0 @@
!@#$%^&
0-333
23-000
61-23
61-680
BigFoot

11
TaskC03/run.py Normal file
View File

@ -0,0 +1,11 @@
def is_valid_nip(nip):
parts = nip.split("-")
if len(parts) == 4:
lengths = list(map(len, parts))
return (lengths == [3, 3, 2, 2] or lengths == [3, 2, 2, 3]) and all(part.isdigit() for part in parts)
return False
with open("test.in", "r", encoding="utf-8") as file:
for line in file:
line = line.strip()
print("yes" if is_valid_nip(line) else "no")