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 |
大家帮忙看一下,怎么会WA啊#include <string.h> #include <iostream> using namespace std; int main() { char tt[1000]=" ", done, in, out[1000]=" "; int count, pos, size, k=0; cin>>tt; cin>>count; while(count>0) { cin>>done; size=strlen(tt); if(done=='I') { cin>>in>>pos; if(pos>size) tt[size]=in; else { for(int i=size;i>=pos;i--) tt[i]=tt[i-1]; tt[pos-1]=in; } } else if(done=='Q') { cin>>pos; size=strlen(tt); if(pos<=size) { out[k]=tt[pos-1]; k++; } } count--; } for(int j=0;j<size;j++) cout<<out[j]<<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