本文共 1548 字,大约阅读时间需要 5 分钟。
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6716 Accepted Submission(s): 2492
1 #include2 using namespace std; 3 int main() 4 { 5 int a[100005]; 6 int n,m,i,j,k; 7 while(scanf("%d%d",&n,&m)&&m&&n) 8 { 9 k=0;10 for(i=0;i n)14 {15 for(i=n-1;i>=0;i--)16 {17 printf("%d",a[n]);18 if(i!=0)19 printf(" ");20 }21 printf("\n");22 continue;23 }24 for(i=n-1;i>=n-m;i--)25 {26 if(a[i]<0)27 {28 j=i;29 k=1;30 break;31 }32 printf("%d",a[i]);33 if(i!=n-m)34 printf(" ");35 }36 if(k!=0)37 {38 for(i=j;i>=0;i++)39 {40 printf("%d",a[i]);41 if(i!=0)42 printf(" ");43 }44 }45 printf("\n");46 }47 return 0;48 }
转载地址:http://gsfna.baihongyu.com/