Seems this question is eligible to be certified as a code golf problem!
ali.S · 2012-09-16 14:30:18
Yeah, so far I'm the best (after python guys)! who can beat me?
AMiR · 2012-09-19 23:43:46
81 characters :D
ali.S · 2012-09-20 00:34:22
80 let's see if you can beat this one!
ali.S · 2012-09-20 00:37:59
79 and I don't want any more arguement.
AMiR · 2012-09-20 00:58:27
ali.S said:
79 and I don't want any more arguement.
I've cast the spell! :D 76 characters!
ali.S · 2012-09-20 01:29:18
Seems I know better spells! Done in only 72
AMiR · 2012-09-20 13:52:03
ali.S said:
Seems I know better spells! Done in only 72
Wow! :D
Here is mine:
main(i, s){
for(s=8;
i=getchar(), s+i-18;
s=i-10?s+i-48:printf("%d\n",s%9+1)+6
);
}
ali.S · 2012-09-20 14:07:25
I don't think anyone will ever be able to get smaller than this, so here is my code (with all it's revisions)!
a;
main(c)
{
for(;c=getchar()+a-10;a=c-a?c-38:printf("%d\n",a%9?a%9:9)*0); /*fixed a bug happened at 021*/
// for(;c=getchar()+a-48;a=c-a+38?c:printf("%d\n",a%9?a%9:9)*0); /*72 char*/
// for(;c=getchar(),c+a-64;a=c<11?printf("%d\n",a%9?a%9:9),0:a+c+6); /*76 char*/
// for(;scanf("%c",&c),c+a-64;a=c<11?printf("%d\n",a%9?a%9:9),0:a+c+6); /*79 char*/
// for(;scanf("%c",&c),c+a-10;a=c<11?printf("%d\n",a%9?a%9:9),0:a+c-48); /*80 char*/
// for(;scanf("%c",&c),c>10?a+=c-48,1:a;c<11?printf("%d\n",a%9?a%9:9),a=0:0); /*85 char*/
}
Mahdi Dehghani · 2012-09-21 00:04:10
ali.S said:
I don't think anyone will ever be able to get smaller than this, so here is my code (with all it's revisions)!
a; main(c) { for(;c=getchar()+a-10;a=c-a?c-38:printf("%d\n",a%9?a%9:9)*0); /*fixed a bug happened at 021*/ // for(;c=getchar()+a-48;a=c-a+38?c:printf("%d\n",a%9?a%9:9)*0); /*72 char*/ // for(;c=getchar(),c+a-64;a=c<11?printf("%d\n",a%9?a%9:9),0:a+c+6); /*76 char*/ // for(;scanf("%c",&c),c+a-64;a=c<11?printf("%d\n",a%9?a%9:9),0:a+c+6); /*79 char*/ // for(;scanf("%c",&c),c+a-10;a=c<11?printf("%d\n",a%9?a%9:9),0:a+c-48); /*80 char*/ // for(;scanf("%c",&c),c>10?a+=c-48,1:a;c<11?printf("%d\n",a%9?a%9:9),a=0:0); /*85 char*/ }
Here is the new revision of your code (70 characters):
for(;c=getchar()+a-10;a=c-a?c-38:printf("%d\n",--a%9+1)*0);
- 1
- 2