markdown 在线制作ppt json校验和格式化工具

POJ 2681

 1 #include<iostream>
 2 #include<stdio.h>
 3 #include<string>
 4 #include<algorithm>
 5 #define MAXN 50
 6 using namespace std;
 7 char ch1[MAXN];
 8 char ch2[MAXN];
 9 int dig1[MAXN];
10 int dig2[MAXN];
11 int main()
12 {
13     //freopen("acm.acm","r",stdin);
14     int num;
15     char c;
16     int i;
17     int j;
18     int ans;
19     int len[2];
20     int time;
21     int place;
22     int begin;
23     cin>>num;
24     getchar();
25     for(time = 1; time <= num; ++ time)
26     {
27         ans = 0;
28         memset(dig1,-1,sizeof(dig1));
29         memset(dig2,-1,sizeof(dig2));
30         gets(ch1);
31         gets(ch2);
32         len[0] = strlen(ch1);
33         len[1] = strlen(ch2);
34         for(i = 0; i < len[0]; ++ i)
35         {
36             dig1[i] = ch1[i] - 'a';
37         }
38         for(i = 0; i < len[1]; ++ i)
39         {
40             dig2[i] = ch2[i] - 'a';
41         }
42         //sort(dig2,dig2+len[1]);
43         //sort(dig1,dig1+len[0]);
44         begin = 0;
45         for(i = 0;i < len[0]; ++ i)
46         {
47             for(j = 0; j < len[1]; ++ j)
48             if(ch1[i] == ch2[j])
49             {
50                 ch2[j] = '~';
51                 ++ ans;
52                 break;
53             }
54         }
55         cout<<"Case #"<<time<<":  "<<len[0]+len[1]-2*ans<<endl;
56         ch1[0] = '\0';
57         ch2[0] = '\0';
58     }
59 }

 

posted @ 2015-06-11 11:45  GavinHacker  阅读(191)  评论(0编辑  收藏  举报
markdown 在线制作ppt json校验和格式化工具