LINK:
题意是输入3个字符串,如果前两个字符串中的字符出现的次数和第三个字符串一样就输出yes,否则输出no
很简单的题目,c语言下用哈希,c++直接stl,python则更简单
c:
- #include<cstdio>
- int main()
- {
- int A[256] = {0};
- char S[256];
- scanf("%s", S);
- for(int i=0; S[i]; ++i) A[(int)S[i]]++;
- scanf("%s", S);
- for(int i=0; S[i]; ++i) A[(int)S[i]]++;
- scanf("%s", S);
- for(int i=0; S[i]; ++i) A[(int)S[i]]--;
- int ok = 1;
- for(int i=0; i<256; ++i)
- if(A[i]!=0) ok=0;
- puts(ok ? "YES" : "NO");
- return 0;
- }
c++
- # include <iostream>
- # include <string>
- # include <algorithm>
- using namespace std;
- int main()
- {
- string s, t, q;
- cin >> s >> t >> q;
- s += t;
- sort(s.begin(), s.end());
- sort(q.begin(), q.end());
- if (s == q)
- cout << "YES";
- else
- cout << "NO";
- return 0;
- }
python
- x = (raw_input() + raw_input())
- y = raw_input()
- print "YES" if sorted(x) == sorted(y) else "NO"
posted on 2012-01-10 23:41
玉香 阅读(1408)
评论(0) 编辑 收藏 引用 所属分类:
CodeForces