| TypeCast/ziptitap | TypeCast/Rizvan Zaidullin | ||||
|---|---|---|---|---|---|
| f | 1 | import sys | f | 1 | import sys |
| 2 | from functools import wraps | 2 | from functools import wraps | ||
| 3 | 3 | ||||
| 4 | 4 | ||||
| t | 5 | def cast(new_type): | t | 5 | def cast(typ): |
| 6 | def dec(func): | 6 | def decorator(fun): | ||
| 7 | @wraps(func) | 7 | @wraps(fun) | ||
| 8 | def new_func(*args): | 8 | def newfun(*args): | ||
| 9 | return new_type(func(*args)) | 9 | return typ(fun(*args)) | ||
| 10 | return new_func | 10 | return newfun | ||
| 11 | return dec | 11 | return decorator | ||
| 12 | 12 | ||||
| 13 | 13 | ||||
| 14 | exec(sys.stdin.read(), globals()) | 14 | exec(sys.stdin.read(), globals()) | ||
| 15 | 15 | ||||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||