-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import re | ||
from collections import Counter | ||
|
||
|
||
def f(chemical, k=1): | ||
res = Counter() | ||
regex = re.compile(r"(\d+|\w)") | ||
prev = "" | ||
|
||
for c in regex.split(chemical): | ||
if c.isalpha(): | ||
res[c] += 1 | ||
elif c.isdigit(): | ||
res[prev] += int(c) - 1 | ||
else: | ||
continue | ||
prev = c | ||
for v in res: | ||
res[v] *= k | ||
return res | ||
|
||
|
||
s, k = input().split() | ||
t = input() | ||
|
||
a = f(s, int(k)) | ||
b = f(t) | ||
|
||
made = True | ||
for v in b: | ||
if v not in a: | ||
made = False | ||
break | ||
else: | ||
b[v] = a[v] // b[v] | ||
|
||
print(0 if not made else min(b.values())) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
n, p = [int(d) for d in input().split()] | ||
nouns = dict(tuple(input().split()) for _ in range(n)) | ||
phrases = [] | ||
for _ in range(p): | ||
row = input().split() | ||
row[-1] = nouns[row[-1]] | ||
phrases.append(" ".join(row)) | ||
rules = ( | ||
"number of c", | ||
"amount of m", | ||
"most c", | ||
"most m", | ||
"fewest c", | ||
"least m", | ||
"more c", | ||
"more m", | ||
"fewer c", | ||
"less m", | ||
"many c", | ||
"much m", | ||
"few c", | ||
"little m", | ||
) | ||
for row in phrases: | ||
if row in rules: | ||
print("Correct!") | ||
else: | ||
print("Not on my watch!") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
std::cout << "VELKOMIN!"; | ||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("VELKOMIN!") | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("VELKOMIN!") |