| ||||||||||
| 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 | |||||||||
Re:G++ is AC,C++ is WA , but why?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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator