cielavenir

GCJ2012 C-large errata

Apr 15th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. --- gcj2012qC.c (revision 23)
  2. +++ gcj2012qC.c (working copy)
  3. @@ -4,12 +4,12 @@
  4.         scanf("%d%d",&a,&b);
  5.         for(n=a,l=10;n/10;n/=10)l*=10;
  6.         for(n=a,r=0;n<=b;n++){
  7. -           for(p=q=0,L=10;L<l;L*=10){
  8. +           for(p=q=0,L=1;L<l;L*=10){
  9.                 m=(n%L)*(l/L)+n/L;
  10.                 if(n==m)p++;
  11.                 if(n<m&&m<=b)q++;
  12.             }
  13. -           if(q)r+=q-p;
  14. +           r+=q/p;
  15.         }
  16.     }
  17.  }
Advertisement
Add Comment
Please, Sign In to add comment