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 |
求解释。#include<stdio.h> #include<string.h> int main() { int s[105]; int i,n,m,k,a,b,temp; char c; while(scanf("%d %d %d",&n,&m,&k),n+m+k>0) { memset(s,0,sizeof(s)); for(i=0;i<k;i++) { getchar(); scanf("%c",&c); if(c=='g') { scanf("%d",&a); s[a]++; } else if(c=='e') { scanf("%d",&a); s[a]=0; } else if(c=='s') { scanf("%d %d",&a,&b); temp=s[a]; s[a]=s[b]; s[b]=temp; } } for(i=1;i<n;i++) printf("%d ",s[i]); printf("%d\n",s[n]); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator