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

求解释。

Posted by happy__ting at 2010-05-11 22:01:16 on Problem 3735
#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:
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