Skip to main content
5 of 8
deleted 76 characters in body
isaacg
  • 42.1k
  • 5
  • 73
  • 213

#Pyth, 134 - 20 - 15 = 99

=Z/lzQ=ks^lz.5Jm]dUzL[-bk+bk?tb%bkb?hb%hbkb)FNJIgNZB~Jm+NkyeN;KS{msm+@zd@S*Z<GQxsbdUzfqSsTUz^fqsmv@*ZzkY/smvbzQJQ|jb<K/lKu*GhHUQ1"None

Notes:

  • Saved 10 characters by switching to newline separated input.

  • Fixed a bug involving groups not of size equal to the side length of the matrix. +14 characters.

Test run:

pyth programs/sum_group.pyth <<< '156790809
3'
1a5a6b7c9a0b8c0c9b
    
pyth programs/sum_group.pyth <<< '156790808
3'
None

pyth programs/sum_group.pyth <<< '1221
2'
1a2a2b1b
1a2b2a1b
isaacg
  • 42.1k
  • 5
  • 73
  • 213