首页
DreamJudge
院校信息
专业题库
模拟考试
机试真题
上岸课程
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
16696033405
2025年3月26日 10:51
字母统计 题解:
P1292
回复 0
|
赞 0
|
浏览 55
#include <stdio.h> #include <stdlib.h> #include<string.h> #define MAX 1000 int main() { char s[MAX]; int a[128]; memset(a,0,128*4); gets(s); for(int i=0;s[i]!='\0';i++){ &nbs...
阿灿
2025年3月24日 21:34
字母统计 题解:map
P1292
回复 0
|
赞 3
|
浏览 60
#include<bits/stdc++.h> using namespace std; int main(){ map<char ,int> m; string str; cin>>str; for(char c:str){ m[c]++; } for(char i='A';i<='Z';i++){ cout<<i<<":"<<m[i]<<endl; } }
cc12345
2025年3月16日 20:52
字母统计 题解:用数组1到26记录出现次数;
P1292
回复 0
|
赞 5
|
浏览 162
#include<bits/stdc++.h> using namespace std; int main() { string s; getline(cin,s); int num[27]={0}; for(int i=1;i<=26;i++) //字母循环检查 { for(int j=0;j<s.length();j++) { if(s[j]=='A'+i-1) { num[i]++; } } char zimu='A'+i-1; cout<<zimu<<":"<<num[i]&l...
Xsw777
2025年3月12日 09:54
字母统计 题解:纯C语言 简单好理解
P1292
回复 0
|
赞 6
|
浏览 177
#include <stdio.h> #include <string.h> int main(){ char a[10000] = {0}; while(gets(a)){ int len = strlen(a); int i; int b[26] ...
jaygee_
2025年3月9日 21:12
字母统计 题解:
P1292
回复 0
|
赞 7
|
浏览 144
熟用map并记住字符也可遍历 #include <bits/stdc++.h> using namespace std; int main() { string s; map<char, int> map; while(getline(cin, s)) { for(int i = 0; i < (int)s.length(); i++) { if(s[i] >= 'A' && s[i] <= 'Z') { map[s[i]] ++; } } ...
JaredWang
2024年9月11日 16:19
字母统计 题解:
P1292
回复 0
|
赞 10
|
浏览 1.1k
#include<bits/stdc++.h> using namespace std; int record(char m,char *a,int n) { int count=0; for(int i=0;i<n;i++) { if(a[i]==m) count++; } retur...
ccccccyes
2024年8月28日 09:35
字母统计 题解:
P1292
回复 0
|
赞 13
|
浏览 1.5k
#include <iostream> using namespace std; int arr[30] = {0}; int main(){ string str; int index; cin>>str; for(int i = 0; i<=str.size()-1; i++){ if(str[i]>='A'&&str[i]<='Z'){ index = str[i] - 'A'; //从arr[0]开始 arr[index]++; }...
可可爱爱草莓派
2024年8月25日 18:05
字母统计 题解:用的map
P1292
回复 0
|
赞 5
|
浏览 587
#include<bits/stdc++.h> using namespace std; int main(){ string s; while (getline(cin,s)){ map<char,int> m; int len = s.size(); char c = 0; &n...
Candour
2024年4月28日 00:11
字母统计 题解:
P1292
回复 0
|
赞 2
|
浏览 836
#include <bits/stdc++.h> using namespace std; string str; int cnt[27]; int main() { while(cin >> str) { memset(cnt, 0, sizeof cnt); for(int i = 0; i < str.size(); i ++) if(str[i] >= 'A' && str[i] <= 'Z') cnt[str[i] - 'A'] ++; for(...
1576684866
2024年3月21日 16:17
字母统计 题解:
P1292
回复 0
|
赞 0
|
浏览 979
#include <cstdio> using namespace std; #include <string.h> #include <iostream> #include <map> #include <stdlib.h> int main() { map<char, int>M; for (int i = 0; i < 26; i++) { &nbs...
1
2
3
4
题目
字母统计
题解数量
31
发布题解
在线答疑
热门题解
1
字母统计 题解:
2
字母统计 题解:
3
字母统计 题解:
4
字母统计 题解:纯C语言 简单好理解
5
字母统计 题解:用的map
6
字母统计 题解:用数组1到26记录出现次数;
7
字母统计 题解:
8
字母统计 题解:map
9
字母统计(交大机试)
10
字母统计 题解: