2
1
Fork 0

Day 6/C: Art!

This commit is contained in:
Mia Herkt 2021-12-06 20:15:25 +01:00
parent 08b2b7179e
commit c4ae46fcbe
Signed by: mia
GPG Key ID: 72E154B8622EC191
1 changed files with 8 additions and 9 deletions

View File

@ -1,11 +1,10 @@
#include <stdio.h>
#define l(v,e) for(v=0;v<e;v++)
#define P printf("Solution %d: %lu\n",s,c)
#define C(r) if(i==r){c=0;l(I,9)c+=F[I];P;s++;}
int main(void){
size_t F[9]={0},f,c;int i,j
,I,s=1;while(fscanf(stdin,"%i%*c",
&i)==1)F[i]++;l(i,256){f=F[0];l(j,
8)F[j] =F[j+1];F[8]=f;F[6]+\
=f; C(79)}C(i)}
int main(){
#define l(v,e)for(v=0;v<e;v++)
#define P printf("Solution %d: %lu\n",s,c)
size_t F [9]={0},c;int i,I,s=1;while(fscanf
#define C(r) if(i==r){c=0;l(I,9)c+=F[I];P;s++
(stdin,"" "%i%*c", &i)==1) F[i]++;l(i,256)
{F[(i+ 7)%9]+=F[i % 9]; C(79)
;}} C(i);}}