ZOJ3441. Crack Me II

[cpp + indent, sorting, set_difference]

```cpp ZOJ3441txt.c > ZOJ3441cpp.c
```

```indent ZOJ3441cpp.c
```

ZOJ3442. Complex Calculator

[complex, eval, regex]

```#include <stdio.h>
#include <stdarg.h>
#include <complex.h>

double gao(double x) {
return -5e-7 < x && x < 5e-7 ? 0 : x;
}

void dump(const char *format, ...) {
va_list ap;
complex double z;

va_start(ap, format);
while (1) {
z = va_arg(ap, complex double);
if (z == 0) {
break;
}
printf(format, gao(creal(z)), gao(cimag(z)));
}
va_end(ap);
}

int main(void) {
dump(
"%+lf%+lf*i\n",
1.*I*I,
cpow(-1.*I,2.),
csqrt(-1.),
8.+6.*I/8.-6.*I,
(8.+6.*I)/(8.-6.*I),
(8.+6.*I)*conj(8.-6.*I),
2.*cexp(I*cacos(-1.)/6.),
cpow(I,I),
ccos(I),
ccos(-1.*I),
cacos(ccos(I)),
cacos(ccos(I*-1.)),
cpow(cexp(1.),cacos(-1.)*I),
(complex double)0.
);

return 0;
}
```

```#include <math.h>
#include <stdio.h>
#include <complex.h>

#ifndef EXPR
#define EXPR cacos(1+2I) / csqrt(6-4I)
#endif

double f(double x) {
return fabs(x) < 5e-7 ? 0 : x;
}

int main() {
double complex ans = EXPR;

printf("%+lf%+lf*i\n", f(creal(ans)), f(cimag(ans)));

return 0;
}
```

```#!/usr/bin/perl

while (<>) {
chomp;
s/\bi\b/I/g;
s/[a-z]+/c\$&/g;
s/(?<!\.|\d)(\d+)(?!\.|\d)/\$1./g;
s/cconj/conj/g;
#	print "\$_\n";
die if system("gcc gao.c -D'EXPR=\$_' -lm") != 0;
system("./a.out | tee -a stdout");
}
```

ZOJ3443. Bessel Function II

[math, C (programming language), yet-another-easy-problem]

```#include <math.h>
double ans = yn(n, z);
```

```ce.cpp:3: error: ‘double y1’ redeclared as different kind of symbol
/usr/include/bits/mathcalls.h:242: error: previous declaration of ‘double y1(double)’
```

2 Responses to “[题解](续II)Let’s Celebrate the 100th Contest on ZOJ!”
1. Navi says:

Crack Me II人肉换行的表示压力很大…

2. Navi says:

-.- sf

3.