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 acmsxl at 2014-08-09 14:22:55 on Problem 3917
#include <stdio.h>
#include <string.h>
int main()
{
	int i,j,n;
	char a[105],b[105];
	while(scanf("%s",a)!=EOF)
	{
		scanf("%s",b);
		if(a[0]=='E'&&b[0]=='E')
			break;
		int len=strlen(a);
		int sum1=0,sum2=0;
		for(i=0;i<len;i++)
		{
			if(a[i]=='R'&&b[i]=='S')
				sum1++;
			else if(a[i]=='R'&&b[i]=='P')
				sum2++;
			else if(a[i]=='S'&&b[i]=='P')
				sum1++;
			else if(a[i]=='S'&&b[i]=='R')
				sum2++;
			else if(a[i]=='P'&&b[i]=='R')
				sum1++;
			else if(a[i]=='P'&&b[i]=='S')
				sum2++;
			else 
				continue;
		}
		printf("P1: %d\n",sum1);
		printf("P2: %d\n",sum2);
	}
	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