首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
xsw
2026年2月6日 12:23
变位词 题解:
P1032
回复 0
|
赞 0
|
浏览 6
#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
|
浏览 56
#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
|
赞 0
|
浏览 105
#include <bits/stdc++.h> using namespace std; int main() { int n ; cin >> n; while(n--) { string s1,s2; cin >> s1 >> s2; ...
zxjrheaven
2025年3月23日 16:41
变位词 题解:暴力
P1032
回复 0
|
赞 12
|
浏览 1.0k
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; for(int i=0;i<n;i++) { char str1[1005]; char ...
xiaowaya
2025年3月23日 16:32
变位词 题解:简单sort 然后strcmp就行了
P1032
回复 0
|
赞 10
|
浏览 1.2k
#include<bits/stdc++.h> #include<string> #include<string.h> using namespace std; void sort(char s[100]){ int len=strlen(s); for(int i=0;i<len;i++){ for(int j=0;j<len-1;j++){ &n...
阿灿
2025年3月15日 06:26
变位词 题解:直接删除 很爽的
P1032
回复 0
|
赞 7
|
浏览 1.0k
#include<bits/stdc++.h> using namespace std; int main(){ int n,flag; string a,b; cin>>n; while(n--){ cin>>a>>b; flag = 0; for(char c:a){ if(b.find(c)!= string::npos){ b.erase(b.find(c),1); }else{ cout<<"No"<<endl; ...
blackbook537
2025年3月14日 16:07
变位词 题解qsort排序
P1032
回复 0
|
赞 8
|
浏览 1.2k
#include<stdio.h> #include<string.h> #include<stdlib.h> //比较函数,用于qsort排序 int compare(const void *a, const void *b){ return (*(char *)a - *(char *)b); } //判断两个单词是否为变位词 int areAnagrams(char *str1, char *str2){ //如果长度不同,直接返回0...
Candour
2025年1月25日 16:24
变位词 (哈希表)题解:
P1032
回复 0
|
赞 6
|
浏览 1.2k
#include<bits/stdc++.h> using namespace std; int n; unordered_map<char, int> h; bool check(string a, string b) { for(int i = 0; i < a.size(); i ++) h[a[i]] ++; for(int i = 0; i < b.size(); i ++) h[b[i]] --; for(auto v : h) if(v.second < 0) return false; ...
可可爱爱草莓派
2024年7月21日 12:13
变位词 题解:用map<char,int>
P1032
回复 0
|
赞 4
|
浏览 1.2k
#include<bits/stdc++.h> using namespace std; int main(){ int n; char ch; cin >> n; string s1,s2; while (n > 0){ n -= 1; map<char,int>...
yanmy
2024年3月23日 19:32
变位词 题解:统计各字母数量
P1032
回复 0
|
赞 30
|
浏览 1.6k
#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; ...
1
2
3
题目
变位词
题解数量
22
发布题解
在线答疑
热门题解
1
变位词 题解:统计各字母数量
2
变位词 题解:c-排序直接比较大小
3
变位词 题解:暴力
4
变位词 题解:简单sort 然后strcmp就行了
5
变位词 题解qsort排序
6
变位词 题解:先sort()排序再比较
7
变位词 题解:直接删除 很爽的
8
变位词 (哈希表)题解:
9
输入字符串s1与s2,比较字符串s2是否为字符串s1变换而来
10
变位词 题解:用map<char,int>