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

回过头来看这道题。。。才知道过得惊险!!!主要是数据太水~~~不然就WA。。。

Posted by 810974380 at 2009-10-26 12:49:49 on Problem 3589
#include<iostream>
using namespace std;
int main()
{ int n,i,j,k,l,num1,num2;
  char a[5],b[5];
  cin>>n;
  for(l=1;l<=n;l++)
  {
     cin>>a>>b;
     num1=0;num2=0;
     for(i=0;i<4;i++)
     for(j=0;j<4;j++)
	  if(a[i]==b[j]) num1++;
     for(k=0;k<4;k++)
	  if(a[k]==b[k]) num2++;
	  cout<<num2<<'A'<<num1-num2<<'B'<<endl;
  }
  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