fork download
  1. // C (194) for Simple Life Game @ CodeIQ
  2. i;j;
  3. char a[1<<16];
  4. main(n,h,w,s,t){
  5. for(scanf("%d%d%d %[^0]",&n,&h,&w,a),s=++w*h;i/s<n;a[i+s]=a[i++]^4&t)
  6. for(t=67196,j=17;j;t/=a[--j<9?i/s*s+(i/w-j/3-~h)%h*w+(i%w-j%3+w)%~-w:i]/5-7);
  7. j/=puts(a+i);
  8. }
Success #stdin #stdout 0.03s 2180KB
stdin
30
40
35
...*.............*.*............*..
.....*.*...***......**......*......
**..........*..........*..*...**.**
...*...*...*.........*......**.*...
...*..*.......*.....**.*........**.
.**........**....*.......*......*..
...........*..*..*...*..*.......***
...*....*..............*......**...
.....*........*.*...*...*..**..*.*.
.....*.............*........*....**
....*......*.*..*..*.....*...*.....
........*.....*...*........*...*...
*...............*......*.*..****...
.*........*...**............*......
*..**...**.*......*.............**.
...*..*...*...**..*.........**.*...
......**........*.............**...
.***..*.*....*..***...**...........
.....*...**........................
..*...**........*.....*...*....**..
*....*....*....**..*........*......
........*....*****......*......*.**
........................*...*..**.*
*...*.....*..*......**....***....**
.....**......*......**.*........*.*
.*....*.*............*.*...........
.*......*.**...**................**
.......**.*...*...*..*....*..*..**.
....**..*...*...*..*......*..*.....
......*....*...*.*.*...............
..**.*..**........*.........*...*.*
....*..*.....*.**.............*.*..
...*..*.*..*..*.**..**..*......*...
..****.*....**.......*.........*.*.
.**.*......**.*....*.*..**.**...*..
........**..............*....*..*.*
..*...*.*....*...*..*.......*......
...**...**....*.*.*.***.*.*........
*..*....***.*...*..........*....*..
....*......*..*.......*...*..*.*...
stdout
**.....**......*..*.........*.....*
***.........................*.....*
.**...............................*
...............***..........*..*...
...........*...*............***....
..........**.......................
..........**..***..................
............*..**..................
............*..**..................
.............*.*...................
.............*.*...................
.............*.*...................
.**..........*.*...................
..............*....................
...................................
.................................**
.................................**
...................................
...................................
.......***.........................
.......*....................**.....
.......***..**.......**....*..*....
....................*.**..*........
..............*......*..*.*........
............*..*.....*..*.*........
...........**.**.......**....*.****
............*.*........*..***.***.*
...*.........*..........*.*..**....
...*.***...............**.....*....
........*...............*.****.....
.....*...................****......
.....*....................*........
......*...*........................
........*.*........................
.........*..................**.....
...........................*..*....
................*..........**.**...
....*..**......*.*..........*.**..*
.........*.....*...........**..*.**
....*....*.......**.........*...*..