Skip to content

Instantly share code, notes, and snippets.

@wasabili
Created October 22, 2010 13:57
Show Gist options
  • Save wasabili/640572 to your computer and use it in GitHub Desktop.
Save wasabili/640572 to your computer and use it in GitHub Desktop.
Aznyan (formatted)
int stk[2<<14];
int ps=0;
int kofi(){
char a[2<<15];
int c[2<<15];
int n;
int s;
unsigned char d[2<<14];
int p;
int jm;
int i,j,k;
char msg[] = {0x2A,0x2A,0x57,0x65,0x6c,0x63,0x6f,0x6d,0x65,0x20,0x74,0x6f,0x20,0x4b,0x2d,0x6f,0x6e,0x20,0x46,0x78,0x78,0x6b,0x21,0x2A,0x2A,0x0A};
int len = 26;
for(i=0;i<len;i++) putchar(msg[i]);
while(1){
char ppt[] = {0x3e,0x20};
for(i=0;i<2;i++) putchar(ppt[i]);
gets(a);
ps=s=p=jm=0;
for(n=0;a[n]!='\0';n++);
n/=12;
for(i=0;i<n;i++){
k=0;
for(j=0;j<3;j++){
k*=2;
if(a[i*12+j*4] == -126 && a[i*12+j*4+1] == -67) k+=1;
}
c[i] = k;
}
for(i=0;i<(2<<14);i++) d[i] = 0;
for(s=0;s<n;s++){
k=c[s];
if(jm){
if(k == 6) jm++;
else if(k == 7) jm--;
}else{
if(k==0)++p;
else if(k==1) {--p;}
else if(k==2) {++d[p];}
else if(k==3) {--d[p];}
else if(k==4) {putchar(d[p]);}
else if(k==5) {d[p] = getchar();}
else if(k==6){
if(d[p]) stk[ps++]=s-1;
else jm = 1;
}else{if(d[p]) {s = stk[--ps];}}
}
}
puts("");
}
}
main(int ac,char *av[]){
(ac > 1 && av[1][0] == 97)? a537():kofi();
}
int dp[3001][2001];
int a537(){
int n,m,s,i,j,k;
char a[256];
gets(a);
for(j=n=m=s=i=0,skp=1;a[i]!='\0';i++){
if(48 <= a[i] & a[i] <= 57) {
skp=0;
if(j==0) n=n*10+a[i]-48;
else if(j==1) m=m*10+a[i]-48;
else s=s*10+a[i]-48;
}else if(!skp) ++j,skp=1;
}
for(k=1;k<=s;k++) for(i=1;i<=m;i++) dp[k][i] = (i>=k)? 1:0;
for(i=1;i<n*n;i++)
for(k=s;k>=1;k--)
for(j=1;j<=m;j++)
if(k>=j) dp[k][j] = (dp[k-j][j-1]+dp[k][j-1])%100000;
else dp[k][j] = dp[k][j-1];
for(j=dp[s][m],i=1;j/10>0;a[i-1]=j%10+48,i++,j=j/10);a[i-1]=j%10+48;
for(j=i-1;j>=0;j--)putchar(a[j]);
puts("");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment