TypeCast/vldubinin | TypeCast/AndrewBabichev | ||||
---|---|---|---|---|---|
n | n | 1 | from functools import wraps | ||
1 | import sys | 2 | import sys | ||
n | 2 | from functools import wraps | n | ||
3 | 3 | ||||
4 | 4 | ||||
t | 5 | def cast(target_type): | t | 5 | def cast(dtype): |
6 | def decorator(fun): | 6 | def decorator(function): | ||
7 | @wraps(fun) | 7 | @wraps(function) | ||
8 | def inner(*args, **kwargs): | 8 | def wrapper(*args, **kwargs): | ||
9 | return target_type(fun(*args, **kwargs)) | 9 | return dtype(function(*args, **kwargs)) | ||
10 | |||||
11 | return inner | 10 | return wrapper | ||
12 | |||||
13 | return decorator | 11 | return decorator | ||
14 | 12 | ||||
15 | 13 | ||||
16 | exec(sys.stdin.read()) | 14 | exec(sys.stdin.read()) | ||
17 | 15 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|