首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
zxjrheaven
2025年3月23日 16:41
变位词 题解:暴力
P1032
回复 0
|
赞 14
|
浏览 1.4k
#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
|
赞 16
|
浏览 1.5k
#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
|
赞 10
|
浏览 1.3k
#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
|
赞 13
|
浏览 1.6k
#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.5k
#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.4k
#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>...
遨游
2024年3月22日 21:59
变位词 题解:先sort()排序再比较
P1032
回复 0
|
赞 8
|
浏览 3.0k
#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
|
浏览 1.3k
#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
|
赞 1
|
浏览 1.8k
#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...
damowanghwj
2024年3月6日 18:49
变位词 题解:map实现哈希表 有点麻烦
P1032
回复 0
|
赞 1
|
浏览 890
#include<cstdio> #include<iostream> #include<string> #include<map> using namespace std; map<char,int> myMap = { {'a',1}, {'b',2},{'c',3},{'d',4},{'e',5} ,{'f',6},{'g',7},{'h',8}...
1
2
3
题目
变位词
题解数量
28
发布题解
在线答疑
热门题解
1
变位词 题解:统计各字母数量
2
变位词 题解:c-排序直接比较大小
3
变位词 题解:简单sort 然后strcmp就行了
4
变位词 题解:暴力
5
变位词 题解qsort排序
6
变位词 题解:
7
变位词 题解:直接删除 很爽的
8
变位词 题解:先sort()排序再比较
9
变位词 (哈希表)题解:
10
输入字符串s1与s2,比较字符串s2是否为字符串s1变换而来