首页
DreamJudge
院校信息
专业题库
模拟考试
机试真题
上岸课程
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
zxjrheaven
2025年3月23日 16:41
变位词 题解:暴力
P1032
回复 0
|
赞 2
|
浏览 54
#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
|
赞 3
|
浏览 115
#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
|
赞 4
|
浏览 171
#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
|
赞 5
|
浏览 226
#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
|
赞 3
|
浏览 325
#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
|
浏览 559
#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
|
赞 24
|
浏览 912
#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; ...
遨游
2024年3月22日 21:59
变位词 题解:先sort()排序再比较
P1032
回复 0
|
赞 4
|
浏览 870
#include <iostream> #include <string> #include <algorithm> using namespace std; bool judge(string s1,string s2){ sort(s1.begin(),s1.end());//排序后比较 sort(s2.begin(),s2.end()); if(s1==s2) &nbs...
huanghu
2024年3月22日 01:10
变位词 题解:C++ sort排序 去重 用map匹配出现次数
P1032
回复 0
|
赞 0
|
浏览 804
#include<stdio.h> #include<iostream> #include<vector> #include<string.h> #include<string> #include<algorithm> #include<map> using namespace std; int main(){ int n; cin>>n; while(n--){ //初始化两个map map<char,int> myMa...
chenxi
2024年3月11日 22:10
变位词 题解:用全排列
P1032
回复 0
|
赞 0
|
浏览 713
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <time.h> #include <algorithm> #include <iostream> #include <queue> #include <stack> #include <vector> #include <string> #include <m...
1
2
题目
变位词
题解数量
19
发布题解
在线答疑
热门题解
1
变位词 题解:统计各字母数量
2
变位词 题解:c-排序直接比较大小
3
输入字符串s1与s2,比较字符串s2是否为字符串s1变换而来
4
变位词 题解qsort排序
5
变位词 题解:先sort()排序再比较
6
变位词 题解:用map<char,int>
7
变位词 题解:直接删除 很爽的
8
变位词 题解:简单sort 然后strcmp就行了
9
变位词 (哈希表)题解:
10
变位词(先排序再比较)