主站
DreamJudge
院校信息
专业题库
模拟考试
机试真题
专业课程
讨论区
兑换中心
登录
注册
发布
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
我能走到对岸吗
2024年4月20日 16:09
字母频率 (C++11 哈希表)题解:
P1019
回复 0
|
赞 1
|
浏览 104
#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
|
赞 0
|
浏览 181
#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
|
赞 0
|
浏览 135
#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
|
赞 0
|
浏览 253
#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]; ...
1576684866
2024年3月21日 20:51
字母频率 题解:
P1019
回复 0
|
赞 0
|
浏览 256
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> using namespace std; #include <string.h> #include <algorithm> #include <iostream> #include <map> #include <stdlib.h> int main() { char s[1005]; gets(s); &nb...
小酒
2024年3月16日 18:41
字母频率 题解:
P1019
回复 0
|
赞 0
|
浏览 240
1019解题思路:同样,用数组来记录 #include <bits/stdc++.h> using namespace std; int main() { char a[1000]={0}; gets(a); int l=strlen(a); int b[105]={0}; for(int i=0;i<l;i++) { if(a[i]>='A'&&a[i]<='Z') { int k=0; k=a[i]%65; b[k]++; } if(a[i]>=...
FIVEszc
2024年3月13日 20:51
字母频率 题解:C++
P1019
回复 0
|
赞 0
|
浏览 229
#include <bits/stdc++.h> using namespace std; typedef struct table{ char a; int count; }; char s[1000]; int main() { table alphabet [26]; for(int i=0;i<26;i++) { al...
Cookie‘s AE86
2024年3月13日 10:47
字母频率 题解:c++ vector、set、count实现
P1019
回复 0
|
赞 0
|
浏览 148
#include<bits/stdc++.h> using namespace std; int main(){ string s; getline(cin, s); vector<char> vs; set<char>ss; //将字符串转换成小写 transform(s.begin(), s.end(), s.begin(), ::tolower); //分别将字符串存入动态数组和集合中 for(int i = 0; i < s.size(); i++...
xhpn
2024年3月5日 21:23
字母频率 题解:数组模拟哈希表
P1019
回复 0
|
赞 0
|
浏览 305
#include<stdio.h> #include<string.h> int main(){ int count[26]={0}; int i; char s[1000]; gets(s); int len=strlen(s); for(i=0;i<len;i++){ ...
zx142407789
2024年3月5日 14:27
字母频率 题解:自用笔记
P1019
回复 0
|
赞 0
|
浏览 302
初始化一个字母表并且将频数设为0,通过输入对单个字符逐一记录,考虑到有多个字母有相同频数且是出现次数最多的 #include<stdio.h> typedef struct { char x; int count; }Alphabet; int main() { Alphabet tab[26]; Alphabet max; char ch; int k = 0; for (int i = 0; i < 26; i++) {//初始化字母表 tab[i].x = 'a' + i; tab[i].count = 0;...
1
2
3
题目
字母频率
题解数量
21
发布题解
热门题解
1
使用哈希,感觉应该最简单了
2
题解:字母频率
3
字母频率(感觉要用链表,但是不会啊,所以就用for做了)
4
用STL中的map和string非常方便,只需要先把字符转换成小写就ok了
5
字符频率
6
P1019题解
7
第一想法就是用string做,请各位多指教
8
字母频率 (C++11 哈希表)题解:
9
字母频率(c++)
10
字母频率 题解: