ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1370. Magician

WHY WA#4????
Posted by sokol[TSOGU] 8 May 2009 00:51
WHY WA#4????

#include<stdio.h>
#include<math.h>
void main(){
int v=0,m,n;
scanf("%d",&n);
int* a=new int[n];
int* b=new int[n];
int* c=new int[n];
scanf("%d",&m);

for (int i=1;i<=n;i++){
scanf("%d",&a[i]);
}

 if(m+11<=n){
        for(int j=m+1;j<=11+v;j++){
                 b[j]=a[j];}

         for(int j=m+1;j<=11+v;j++){
                 printf("%d",b[j]);  }
         }
         else {
         v=m;
         while(v>n){
        v=abs(v-n); }
          for(int i=v+1;i<=n;i++){
                 b[i]=a[i];}
          for(int k=1;k<=10-(n-v);k++){
                 c[k]=a[k];}

          for(int i=v+1;i<=n;i++){
                 printf("%d",b[i]);  }

          for(int k=1;k<=10-(n-v);k++){
                  printf("%d",c[k]);  }
                     }
                 }
Re: WHY WA#4????
Posted by Sergey Lazarev (MSU TB) 8 May 2009 01:31
Your program always must output 10 digits. Try this test:
15 16
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
Re: WHY WA#4????
Posted by sokol[TSOGU] 8 May 2009 16:47
Thank you,Sergey Lazarev!=)