fix 1992/albert/albert.c based on albert.fix.c
This commit is contained in:
1 parent
d01a02490a
commit
36efb7cfa7
2 files changed
+26
-178
No files matched your search
+26
-144
@@ -1,152 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <setjmp.h>
|
||||
#include <ctype.h>
|
||||
#define new(PP) (PP *) malloc(sizeof(PP))
|
||||
typedef struct q {
|
||||
jmp_buf ppp;
|
||||
long qq;
|
||||
struct q *P;
|
||||
struct q *p;
|
||||
}
|
||||
PP;
|
||||
|
||||
PP *P;
|
||||
int aaaaaa=2;
|
||||
int aaaaaaa=1;
|
||||
|
||||
long qqq;
|
||||
|
||||
|
||||
aaAaaa(aa,aaa)
|
||||
char *aa;
|
||||
char *aaa;
|
||||
main(argc,argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char aaaa = 0;
|
||||
if ((((( aaa )))))
|
||||
{
|
||||
aaaa = *aa;
|
||||
*aa=0;
|
||||
aa+=strlen(aa+1);
|
||||
P =new(PP);
|
||||
P->P=P;
|
||||
P->p=P;
|
||||
}
|
||||
long arg[100];
|
||||
int i,j;
|
||||
int base = 10;
|
||||
int start = 0;
|
||||
int end= strlen(argv[1]);
|
||||
|
||||
if ((((( !setjmp(P->ppp) )))))
|
||||
|
||||
for (i=0;i<end;i++)
|
||||
arg[i] = argv[1][i]-'0';
|
||||
|
||||
while ( end-start > 2 )
|
||||
{
|
||||
if ((((( !isdigit(*aa) )))))
|
||||
longjmp(P->ppp,aaaaaaa);
|
||||
else {
|
||||
P->p->P = new(PP);
|
||||
P->p->P->P = P;
|
||||
P->p->P->p = P->p;
|
||||
P->p = P->p->P;
|
||||
while ( arg[end-1] == 0 ) {
|
||||
printf("%d\n",base);
|
||||
end--;
|
||||
}
|
||||
while ( arg[start] == 0 ) start +=1;
|
||||
base += 1;
|
||||
|
||||
P->qq = *aa--;
|
||||
P = P->p;
|
||||
aaAaaa(aa,0);
|
||||
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;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( !aaaa&&!*aa )
|
||||
longjmp(P->p->ppp,aaaaaaa);
|
||||
|
||||
if ((((( (P->qq=aaaa)<10 &&!
|
||||
(isdigit(aaaa)) ||!
|
||||
(isdigit(*aa) ||!
|
||||
*aa ))))))
|
||||
{
|
||||
fprintf(stderr,"Usage %c%s <number>\n",
|
||||
(aaa[0]?7:aaaa),aaa+!aaa[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ppPppp(pp,ppp)
|
||||
PP **pp, *ppp;
|
||||
{
|
||||
int aa;
|
||||
if ((((( !(aa=setjmp(ppp->ppp))||aa==aaaaaa )))))
|
||||
{
|
||||
if ((((( *pp==ppp )))))
|
||||
{
|
||||
ppp = (*pp)->p;
|
||||
|
||||
if ( qqq<47 ) return;
|
||||
if ( ppp->qq!=48 ) return;
|
||||
|
||||
while ( ppp->qq==48 )
|
||||
{
|
||||
printf("%ld\n",qqq-45);
|
||||
*pp = ppp;
|
||||
ppp = ppp->p;
|
||||
}
|
||||
qqq -= 1;
|
||||
longjmp(ppp->ppp,aaaaaaa);
|
||||
} else {
|
||||
PP *p;
|
||||
|
||||
ppPppp(pp,ppp->p);
|
||||
for (p=ppp;p!=*pp;p=p->p)
|
||||
{
|
||||
int qq=4;
|
||||
if ((((( qqq<47 &&
|
||||
(qq=0,p->qq+=p->p->qq-96)>=48-qqq ||
|
||||
qqq>46 &&
|
||||
(p->qq-=p->p->qq)<0 )))))
|
||||
{
|
||||
p->qq += qqq+qq;
|
||||
if ( p->p==P && qqq<=46 )
|
||||
{
|
||||
P->p->P = new(PP);
|
||||
P->p->P->P = P;
|
||||
P->p->P->p = P->p;
|
||||
*pp = P = P->p = P->p->P;
|
||||
P->qq = 48;
|
||||
}
|
||||
|
||||
p->p->qq+=qq==0;
|
||||
p->p->qq-=qq!=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
p->qq += 48;
|
||||
}
|
||||
}
|
||||
if ( ppp->P==P ) longjmp(ppp->ppp,aaaaaaa);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qqq += 1;
|
||||
|
||||
while (48==P->qq )
|
||||
{
|
||||
P->P->p = P->p;
|
||||
P = P->p->P = P->P;
|
||||
|
||||
}
|
||||
|
||||
if ( ppp!=ppp->p->p || qqq<47 )
|
||||
longjmp(ppp->ppp,aaaaaa);
|
||||
else
|
||||
{
|
||||
printf("At most one remains\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
main(aaa,aaaa)
|
||||
int aaa;
|
||||
char **aaaa;
|
||||
{
|
||||
aaAaaa(aaa==aaaaaaa?aaaa[0]:aaaa[1],aaaa[0]);
|
||||
qqq = 39;
|
||||
ppPppp(&P,P->p);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user