- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
x = 0; y = 0
def gcd(a, b):
#{
global x, y
if (a == 0):
#{
x = 0; y = 1;
return b;
#}
d = gcd(b%a, a);
t = x
x = y - (b // a) * x;
y = t;
return d;
#}
#int main()
#{
#ios_base::sync_with_stdio(0); in.tie(0);
#I n, p, w, d, dd, ww;
#in >> n >> p >> w >> d;
n, p, w, d = map(int, input().split())
gc = gcd(d, w);
dd = x; ww = y
g = w * d // gc;
if (p % gc):
print(-1); exit(0)
dd *= p // gc;
ww *= p // gc;
if (ww < 0):
#{
di = (-ww + g // w - 1) // (g // w);
ww += g // w * di;
dd -= g // d * di;
if (dd < 0):
print(-1); exit(0)
#}
elif (dd < 0):
#{
di = (-dd + g // d - 1) // (g // d);
dd += g // d * di;
ww -= g // w * di;
if (dd < 0):
print(-1); exit(0)
#}
if (ww < 0 or dd < 0):
print(-1); exit(0)
di = dd // (g // d);
dd -= g // d * di;
ww += g // w * di;
if (ww + dd <= n):
print(ww, dd, n - ww - dd)
else:
print(-1);
#}
Когда на соревновании по спортивному программированию пишешь код на C++ и внезапно понимаешь, что int64_t тебе недостаточно.
Компилируется в «C++», «C#», «PHP», «Java», «Python», «Lua».
В «JS» и в «AS» компилировать не хочет, потому что нужно реализовать ввод-вывод.
И AS3:
https://github.com/paulfitz/haxe
Бинарников нет, поэтому придётся его собирать. Для сборки нужен «OCaml».
The first block or so of the file is examined for strange characters such as control codes or bytes with the high bit set (that don't look like UTF-8). If more than a third of the bytes appear to be strange, it's a binary file; otherwise, it's a text file. Also, any file containing ASCII NUL (\0) in the first block is considered a binary file. docstore.mik.ua/orelly/perl/prog3/ch03_10.htm
Почему именно треть? Есть академические исследования на эту тему?
Весь остальной мир: Ясно. Пошел я на хуй.
Какой багор )))