首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
彻底死去
2026年3月22日 23:09
变位词 题解:
P1032
回复 0
|
赞 1
|
浏览 163
#include<iostream> #include<string> using namespace std; int main() { int n; cin >> n; while (n--) { string s1, s2; cin >> s1 >> s2; bool isMatch = true; // 第一步:先校验长度,长度不同直接不匹配(关键优化) if (s1.length()...
太一
2026年3月18日 23:25
变位词 题解:
P1032
回复 0
|
赞 2
|
浏览 188
#include<iostream> #include<cmath> #include<algorithm> #include<string> #include<map> using namespace std; int main() { int n; string s1, s2; cin >> n; while (n--) { int arr[26] = { 0 }, index = 1, brr[26] = { 0 }; ...
Tyu0871
2026年3月17日 11:50
变位词 题解:哈希
P1032
回复 0
|
赞 0
|
浏览 145
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; while(N--){ string s1,s2; cin>>s1>>s2; bool flag = true; //注意数组必须初始化,否则会初始化随机数。这里用map<char,int>也行 int arr1[1010]={0}; for(int i=0;i<s1.size()...
mlx
2026年3月8日 18:01
变位词 题解:
P1032
回复 0
|
赞 2
|
浏览 210
#include<iostream> #include<map> using namespace std; int n; bool check2(string a,string b) { int sum1=0,sum2=0; for(int i=0;i<a.size();i++) sum1+=a[i]-'a'; for(int i=0;i<b.size();i++) sum2+=b[i]-'a'; if(sum1!=sum2) return false; ...
yanmy
2024年3月23日 19:32
变位词 题解:统计各字母数量
P1032
回复 1
|
赞 40
|
浏览 1.9k
#include <stdio.h> #include <string.h> int main() { int n; scanf("%d", &n); while (n--) { char a[1000], b[1000]; int a1[26] = {0}, b1[26] = {0}; scanf("%s %s", a, b); int lena = strlen(a), lenb = strlen(b), flag = 1; ...
dxuxu
2026年2月14日 18:55
变位词 题解:
P1032
回复 0
|
赞 11
|
浏览 249
受到另一个题解的启发,将字符串排序后直接比较是否相等(无比简洁) #include<bits/stdc++.h> using namespace std; string str1; string str2; int main(){ int n; cin>>n; for(int i=0;i<n;i++){ cin>>str1>>str2; stable_sort(str1.begin(),str1.end()); stable_sort(str2.begin(),str2.en...
曾不会
2026年2月7日 14:51
变位词 题解:
P1032
回复 0
|
赞 0
|
浏览 348
n=int(input()) for ii in range(n): s=list(map(str,input().split())) s1=s[0] s2=s[1] t1=[] t2=[] for i in s1: t1.append(i) tt1=sorted(t1) for i in s...
xsw
2026年2月6日 12:23
变位词 题解:
P1032
回复 0
|
赞 4
|
浏览 416
#include<iostream> #include<algorithm> using namespace std; int main() { int n; cin >> n; while (n -- ) { string s1, s2; cin >> s1 >> s2; sort(s1.begin(), s1.end()); sort(s2.begin(), s2.end()); if (s1 == s2) puts("Yes"); else pu...
yauqq
2026年1月28日 16:33
变位词 题解:
P1032
回复 0
|
赞 0
|
浏览 336
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; string str1,str2; for(int i = 0; i < n; i++){ cin >> str1 >> str2; sort(str1.begin(),str1.end()); sort(str2.begin(),str2.end()); if(st...
bro
2026年1月19日 23:46
变位词 题解:1.直接删除 2.排序
P1032
回复 0
|
赞 4
|
浏览 409
#include <bits/stdc++.h> using namespace std; int main() { int n ; cin >> n; while(n--) { string s1,s2; cin >> s1 >> s2; ...
1
2
3
题目
变位词
题解数量
28
发布题解
在线答疑
热门题解
1
变位词 题解:统计各字母数量
2
变位词 题解:c-排序直接比较大小
3
变位词 题解:简单sort 然后strcmp就行了
4
变位词 题解:暴力
5
变位词 题解qsort排序
6
变位词 题解:
7
变位词 题解:直接删除 很爽的
8
变位词 题解:先sort()排序再比较
9
变位词 (哈希表)题解:
10
输入字符串s1与s2,比较字符串s2是否为字符串s1变换而来