| ||||||||||
| 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 | |||||||||
gets,cin的区别#include <iostream.h>
#include <stdio.h>
#include <string.h>
int main()
{
int col;
while(cin>>col&&col)
{
char a[207];
cin>>a;//gets(a) get a wa but cin>>a gets AC Why??
int len=strlen(a);
int row=len/col;
for(int i=0;i<row;i++)
for(int j=0;j<col/2;j++)
{
if(i%2==1)
{
int temp=a[i*col+j];
a[i*col+j]=a[i*col+col-j-1];
a[i*col+col-j-1]=temp;
}
}
for(i=0;i<col;i++)
for(int j=0;j<row;j++)
{
cout<<a[i+j*col];
}
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