final int line;
Go(int line) { this.line = line; }
static void to(int line) throws Go { throw new Go(line); }
}
abstract class GoToProc {
int line = 0;
final void run() {
while (true) {
try {
proc(line);
return;
} catch (Go goTo) {
this.line = goTo.line;
}
}
}
abstract void proc(int line) throws Go;
}
public class Main {
public static void main
(String[] args
) { GoToProc factorial = new GoToProc() {
int f = 1;
int x = 10;
@Override
void proc(int line) throws Go {
switch (line) {
case 0: if (x == 0) Go.to(4);
case 1: f = f * x;
case 2: x = x - 1;
case 3: Go.to(0);
case 4: System.
out.
println(f
); }
}
};
factorial.run();
}
}
Y2xhc3MgR28gZXh0ZW5kcyBFeGNlcHRpb24gewogICAgZmluYWwgaW50IGxpbmU7CgogICAgR28oaW50IGxpbmUpIHsgdGhpcy5saW5lID0gbGluZTsgfQoKICAgIHN0YXRpYyB2b2lkIHRvKGludCBsaW5lKSB0aHJvd3MgR28geyB0aHJvdyBuZXcgR28obGluZSk7IH0KfQoKYWJzdHJhY3QgY2xhc3MgR29Ub1Byb2MgewogICAgaW50IGxpbmUgPSAwOwoKICAgIGZpbmFsIHZvaWQgcnVuKCkgewogICAgICAgIHdoaWxlICh0cnVlKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBwcm9jKGxpbmUpOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9IGNhdGNoIChHbyBnb1RvKSB7CiAgICAgICAgICAgICAgICB0aGlzLmxpbmUgPSBnb1RvLmxpbmU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CgogICAgYWJzdHJhY3Qgdm9pZCBwcm9jKGludCBsaW5lKSB0aHJvd3MgR287Cn0KCnB1YmxpYyBjbGFzcyBNYWluIHsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKICAgICAgICBHb1RvUHJvYyBmYWN0b3JpYWwgPSBuZXcgR29Ub1Byb2MoKSB7CiAgICAgICAgICAgIGludCBmID0gMTsKICAgICAgICAgICAgaW50IHggPSAxMDsKCiAgICAgICAgICAgIEBPdmVycmlkZQogICAgICAgICAgICB2b2lkIHByb2MoaW50IGxpbmUpIHRocm93cyBHbyB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKGxpbmUpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDA6IGlmICh4ID09IDApIEdvLnRvKDQpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTogZiA9IGYgKiB4OwogICAgICAgICAgICAgICAgICAgIGNhc2UgMjogeCA9IHggLSAxOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMzogR28udG8oMCk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA0OiBTeXN0ZW0ub3V0LnByaW50bG4oZik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGZhY3RvcmlhbC5ydW4oKTsKICAgIH0KfQ==