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

Re:G++ is AC,C++ is WA , but why?

Posted by jyx at 2006-04-03 14:42:56 on Problem 2681
In Reply To:G++ is AC,C++ is WA , but why? Posted by:xax10000 at 2006-04-03 11:29:32
> #include<iostream>
> #include<cstdio>
> #include<string>
> #include<iomanip>
> #include<cmath>
> using namespace std;
> int main(int argc, char* argv[])
> {
> 	char a[40], b[40];
> 	int n;
> 	cin>>n;
> 	cin.ignore();
> 	for(int j = 1; j <= n; ++ j){
> 		gets(a);
> 		gets(b);
> 		int num1[26] = {0}, num2[26] = {0};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 		int len1 = strlen(a);
> 		int len2 = strlen(b);
> 		int i, sum = 0;
> 		for(i = 0; i < len1; ++ i) num1[ a[i] - 'a'] ++;
> 		for(i = 0; i < len2; ++ i) num2[ b[i] - 'a'] ++;
> 		for(i = 0; i < 26; ++ i) sum += (int)abs(num1[i] - num2[i]);
> 		cout<<"Case #"<<j<<":  "<<sum<<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