Files
Cody Boone Ferguson 456120f825 Fix 1992/albert, swap alt/main code
The alt code was the original; the entry was a bug fixed version by Leo
(before he was a judge). However that version, the fixed version, was
not obfuscated and as the judges say in the FAQ:

    the contest is called the IOCCC, not the INVOCCC :-)

so it seems better to have the version that has a bug as the entry. But
that code no longer compiled. This has been fixed.

Updated .gitignore.

Minor changes to README.md wrt the swapping of alt code/entry code. The
formatting has not been checked and no typos have been fixed either.
These will come later.
2023-11-07 08:31:36 -08:00

35 lines
788 B
C

#include <stdio.h>
main(argc,argv)
int argc;
char **argv;
{
long arg[100];
int i,j;
int base = 10;
int start = 0;
int end= strlen(argv[1]);
for (i=0;i<end;i++)
arg[i] = argv[1][i]-'0';
while ( end-start > 2 )
{
while ( arg[end-1] == 0 ) {
printf("%d\n",base);
end--;
}
while ( arg[start] == 0 ) start +=1;
base += 1;
for (i=start+1;i<end;i++)
for (j=i;j>start;j--)
if ( (arg[j]-=arg[j-1])<0 )
{
arg[j]+=base;
arg[j-1] -= 1;
}
}
}