| ||||||||||
| 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 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator