Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:虽然是个水题,但是花了老长时间,终于做出来了,晒一晒

Posted by 09031036 at 2010-11-07 13:29:10 on Problem 2039
In Reply To:虽然是个水题,但是花了老长时间,终于做出来了,晒一晒 Posted by:jinian_08 at 2010-07-04 20:53:39
> #include<iostream>
> #include<cstring>
> using namespace std;
> 
> int main(){
>     int n, i, j, t, r, length;
>     char str[200];
>     char a[100][20];
> 
>     while(cin>>n){
>         if(n==0)
>             break;
>         cin >> str;
>         length = strlen(str);
>         r = length/n;
>         t=0;
>         for(i=0;i<r;i++)
>             for(j=0;j<n;j++){
>                 if(i%2==0)
>                     a[i][j] = str[t];
>                 if(i%2!=0)
>                     a[i][n-1-j] = str[t];
>                 t++;
>             }
>         for(i=0;i<n;i++)
>             for(j=0;j<r;j++)
>                 cout << a[j][i];
>         cout << endl;
>     }
>     return 0;
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator