首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
西电机试专家
2025年3月25日 16:54
字母频率 题解:非常棒的题解
P1019
回复 0
|
赞 1
|
浏览 243
#include<bits/stdc++.h> using namespace std; int main(){ map<char,int> M; string s; getline(cin,s); string str;//只含有小写字母的字符串 for(int i=0;i<s.size();i++){ ...
jaygee_
2025年3月12日 20:33
字母频率 题解:
P1019
回复 0
|
赞 2
|
浏览 503
#include<bits/stdc++.h> using namespace std; int main() { string s; getline(cin, s); map<char, int> map; for(char c : s) { if(isalpha(c)) { char a = tolower(c); map[a] ++; // map记录每个字符出现次数 } } char maxChar = ' '; int maxCount = 0; for(auto c :...
Xsw777
2025年3月3日 16:03
字母频率 题解:纯数组 C语言写法 很好理解
P1019
回复 0
|
赞 10
|
浏览 529
#include <stdio.h> #include <string.h> int main(){ char a[1000] = {0}; gets(a); int i = 0; int len = strlen(a); for(i=0;i<len;i++){ &...
quyang
2025年2月28日 19:20
字母频率 题解:cpp 哈希表 所有字符统计频率
P1019
回复 0
|
赞 3
|
浏览 454
#include<iostream> #include<string> #include<unordered_map> #include<cctype> using namespace std; //从键盘输入一个字符串(可能含有数字、字母、其他可见字符), //输出出现频率最高的英文字母及次数,忽略字母的大小写(如大写A和小写a均视为a) int main(){ string s; getline(cin,s); unordered_map<char,int> mp; //去掉...
固态氧化碳
2025年2月27日 23:17
字母频率 题解:自用
P1019
回复 0
|
赞 5
|
浏览 656
#include<iostream> #include<stdio.h> using namespace std; void func(string &s) { for(int i=0;i<s.length();i++) { if(s[i]>='A'&&s[i]<='Z') { ...
ccccccyes
2024年8月28日 09:50
字母频率 题解:
P1019
回复 0
|
赞 7
|
浏览 1.7k
#include <iostream> using namespace std; int arr[30] = {0}; int main(){ string str; int index; //cin>>str在读到空格时就结束了 getline(cin,str); for(int i = 0; i<=str.size()-1; i++){ if(str[i]>='A'&&str[i]<='Z'){ index = str[i] - 'A'; arr...
Candour
2024年4月20日 16:09
字母频率 (C++11 哈希表)题解:
P1019
回复 0
|
赞 6
|
浏览 819
#include<bits/stdc++.h> using namespace std; unordered_map<char, int> res; int main() { string str; getline(cin, str); for(int i = 0; i < str.size(); i ++) { if(str[i] >= 'A' && str[i] <= 'Z' ) res[str[i] + 32] ++; ...
RingoCrystal
2024年4月3日 15:12
字母频率 题解:想问一下有没有大佬知道,为什么加了while就只能过6
P1019
回复 2
|
赞 1
|
浏览 876
#include <bits/stdc++.h> using namespace std; int main(){ string s; while(getline(cin,s)){ for(int i=0;i<s.size();i++){ if(s[i]>='A'&&s[i]<='Z')s[i]=s[i]-'A'+'a'; } map<char,int> sheet; for(int i=0;i<s.size();i++){ if(s[i]>='a'&...
20082123
2024年3月28日 17:56
字母频率 题解:
P1019
回复 0
|
赞 2
|
浏览 1.5k
#include<bits/stdc++.h> using namespace std; int main(){ string s; int k,max=0; int a[26]={0}; getline(cin,s); for(int i=0;i<s.size();i++){ if('...
williams
2024年3月24日 09:58
字母频率 题解:C
P1019
回复 0
|
赞 4
|
浏览 1.1k
#include <stdio.h> #include <string.h> #include <ctype.h> int main(){ char s[1000],count[30]; for(int i=0;i<30;i++){ count[i]=0; } gets(s); for(int i=0;i<strlen(s);i++){ s[i] = tolower(s[i]); count[(s[i]-97)]++; } int max,d; max = count[0]; ...
1
2
3
题目
字母频率
题解数量
27
发布题解
在线答疑
热门题解
1
字母频率 题解:纯数组 C语言写法 很好理解
2
字母频率 题解:
3
字母频率 (C++11 哈希表)题解:
4
使用哈希,感觉应该最简单了
5
字母频率 题解:自用
6
字母频率 题解:C
7
字母频率 题解:cpp 哈希表 所有字符统计频率
8
字母频率 题解:
9
题解:字母频率
10
字母频率(感觉要用链表,但是不会啊,所以就用for做了)