| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:虽然是个水题,但是花了老长时间,终于做出来了,晒一晒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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator