### Archive for the “solution” Category

ZOJ Monthly, January 2011
A ZOJ3457 Absence Number 19.32% (23/119)
B ZOJ3458 A Simple Math Problem 8.33% (7/84)
C ZOJ3459 Extraordinary 24-Point Game 0.00% (0/0)
D ZOJ3460 Missile 21.73% (20/92)
E ZOJ3461 Money Transfer 30.43% (7/23)
F ZOJ3462 Nobita’s New Filesystem 11.53% (3/26)
G ZOJ3463 Piano 40.74% (11/27)
H ZOJ3464 Rugby Football 42.37% (114/269)
I ZOJ3465 The Hive 28.51% (71/249)
J ZOJ3466 The Hive II 11.11% (1/9)

### ZOJ3458. A Simple Math Problem

source code (ZOJ3458.py) [math]

find $\lfloor(\sqrt{a}+\sqrt{b})^n\rfloor \mod 2(a+b)$, where $0 < b - a < 1 + 2\sqrt{a} \text{ and } n \text{ is even}$

ZOJ Monthly, December 2010
A ZOJ3446 Doraemon’s Battle 13.84% (54/390)
B ZOJ3447 Doraemon’s Number Game 29.66% (35/118)
C ZOJ3448 Doraemon’s Number Game II 0.00% (0/4)
D ZOJ3449 Doraemon’s Number Game III 18.77% (40/213)
E ZOJ3450 Doraemon’s Railgun 11.28% (22/195)
F ZOJ3451 Doraemon’s Shooting Practice 8.33% (2/24)
G ZOJ3452 Doraemon’s Stone Game 33.89% (20/59)
H ZOJ3453 Doraemon’s Sweet Bullet 25.00% (5/20)
I ZOJ3454 Nobita’s Letter 36.36% (8/22)
J ZOJ3455 Shizuka’s Letter 27.95% (26/93)
K ZOJ3456 Traveler Nobita 7.50% (3/40)

### ZOJ3446. Doraemon’s Battle

source code (ZOJ3446.cpp) [search, bfs]

Doraemon初始有lh的血量和0的技能值，有n个敌人，他每回合有4种选择：

• 消灭一个敌人并增加一个技能值；
• 回复lh/5血量；
• 用尽现有技能值s，打掉Ds个敌人；
• 不动。

Doraemon回合之后，若剩下m个敌人，则其血量减少m，技能值增加m%3。Doraemon的血量若小于等于0，就挂了。问最少多少回合消灭所有敌人。

### ZOJ3447. Doraemon’s Number Game

source code (ZOJ3447.py) [greedy, BigInteger]

### ZOJ3441. Crack Me II

[cpp + indent, sorting, set_difference]

cpp ZOJ3441txt.c > ZOJ3441cpp.c


indent ZOJ3441cpp.c


### ZOJ3440. Detect the Virus II

[regex, topSort]

# subparta:=fg|g
$subparta = qr(fg|g); # parta:=a|b|c$parta = qr{a|b|c};
# partb:=d|e[subparta]h
$partb = qr{d|e($subparta)h};
# virus:=[parta][partb][partb]
$virus = qr{($parta)($partb)($partb)};

printf 'abcdefghijklm' =~ $virus ? "YES\n" : "NO\n"; printf 'nopqrstuvwxyz' =~$virus ? "YES\n" : "NO\n";


ZOJ在建站105个月之后迎来了第一百场比赛。

””\\(￣ー￣) (￣ー￣)//””

Let’s Celebrate the 100th Contest on ZOJ!
100A ZOJ3437 Very Hard Problem 6.89% (28/406)
100B ZOJ3438 Tripartite Graph 62.28% (71/114)
100C ZOJ3439 Substitution Cipher 7.86% (36/458)
100D ZOJ3440 Detect the Virus II 0.00% (0/26)
100E ZOJ3441 Crack Me II 2.06% (2/97)
100F ZOJ3442 Complex Calculator 0.00% (0/1)
100G ZOJ3443 Bessel Function II 0.00% (0/0)
100H ZOJ3444 An Unusual Problem 5.12% (2/39)
100I ZOJ3445 1KB 9.09% (4/44)