首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
苍灵
2025年9月2日 16:52
字母统计 题解:C++
P1292
回复 0
|
赞 1
|
浏览 112
#include<bits/stdc++.h> using namespace std; int main(){ string s; while(cin>>s){ int num[25]={0}; for(int i=0;i<s.length();i++){ if(s[i]>=65&&s[i]<=90){ num[s[i]-65]++; } } for(int i=0;i<26;i++){ cout<<char(i+65)<&l...
cczz
2025年8月5日 19:47
字母统计 题解:
P1292
回复 0
|
赞 3
|
浏览 166
#include<bits/stdc++.h> using namespace std; int main(){ string s; getline(cin, s); int cnt[50] = {0}; for(int i = 0; i < s.length(); i++){ if(s[i] >= 'A' && s[i] <= 'Z') cnt[(s[i] - 'A')] ++; } for(int i = 0; i <= ('Z' - 'A'); i++){ cout...
16696033405
2025年3月26日 10:51
字母统计 题解:
P1292
回复 0
|
赞 0
|
浏览 486
#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
|
赞 7
|
浏览 441
#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
|
浏览 602
#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
|
赞 7
|
浏览 539
#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
|
赞 8
|
浏览 582
熟用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
|
浏览 2.2k
#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
|
赞 14
|
浏览 1.8k
#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
|
赞 9
|
浏览 1.0k
#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...
1
2
3
4
题目
字母统计
题解数量
33
发布题解
在线答疑
热门题解
1
字母统计 题解:
2
字母统计 题解:
3
字母统计 题解:用的map
4
字母统计 题解:
5
字母统计 题解:纯C语言 简单好理解
6
字母统计 题解:map
7
字母统计 题解:用数组1到26记录出现次数;
8
字母统计 题解:
9
字母统计 题解:
10
字母统计(交大机试)