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 |
在浙大一直LLT,但在这里却AC了,不明原因.........#include<iostream> #include<string> #include<iomanip> using namespace std; int main() { char s1[50],s2[50]; int j; int n; cin>>n; cin.ignore(); for(j=1;j<=n;j++) { gets(s1); gets(s2); int len1,len2; len1=strlen(s1); len2=strlen(s2); int a1[26]={0},a2[26]={0}; int i; for(i=0;i<len1;i++) a1[s1[i]-'a']++; for(i=0;i<len2;i++) a2[s2[i]-'a']++; int sum=0; for(i=0;i<26;i++) { sum+=int(abs(a1[i]-a2[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