首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
mlx
2026年1月30日 22:10
字母统计 题解:
P1292
回复 0
|
赞 1
|
浏览 155
#include<iostream> #include<cstring> using namespace std; string str; int a[26]; int main() { while(cin>>str) { memset(a,0,sizeof a); for(int i=0;i<str.size();i++) { if(str[i]>='A'&&str[i]<='Z') a[str[i]-'A']++; } for(int ...
yauqq
2026年1月29日 08:03
字母统计 题解:
P1292
回复 0
|
赞 1
|
浏览 149
#include<bits/stdc++.h> using namespace std; int main(){ string str; while(cin >> str){ int times[26] = {0}; for(char c:str){ if(c >= 'A' && c <= 'Z') times[c - 'A' + 0]++; } for(int i=0;i<26;i++){ char k = i + 'A'; cout <<...
曾不会
2026年1月24日 18:38
字母统计 题解:
P1292
回复 0
|
赞 0
|
浏览 221
python字典需要排序使用 import sys for line in sys.stdin: line = line.strip() if not line: continue count = {chr(ord('A') + i): 0 for i in range(26)} # 初始化计数字典 for ch in line: if 'A' <= ch <= 'Z': # 检查是否为大写字母 coun...
曾不会
2026年1月24日 18:15
字母统计 题解:
P1292
回复 0
|
赞 3
|
浏览 189
数组解决 #include<stdio.h> #include<string.h> int main() { char s[110]; fgets(s,110,stdin); int l=strlen(s); int a[27]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; for(int...
exiol
2026年1月22日 20:41
字母统计 题解:c++ 用vector
P1292
回复 0
|
赞 0
|
浏览 110
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { string str; while(cin>>str) { vector<int>ans(26,0); for(int i=0;i<str.size();i++) { if(isupper(str[i])) { ans[str[i]-'A']++; } } ...
奶龙大王
2026年1月16日 20:08
字母统计 题解:
P1292
回复 0
|
赞 0
|
浏览 195
数组模拟map+利用字母和阿斯克码的对应转换关系(强制) #include <stdio.h> #include <string.h> #include<iostream> using namespace std; int main() { string s; while(cin>>s){ ...
无名1
2025年9月2日 16:52
字母统计 题解:C++
P1292
回复 0
|
赞 1
|
浏览 822
#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
|
赞 4
|
浏览 592
#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
|
赞 2
|
浏览 952
#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
|
赞 8
|
浏览 900
#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; } }
1
2
3
4
5
题目
字母统计
题解数量
49
发布题解
在线答疑
热门题解
1
字母统计 题解:
2
字母统计 题解:纯C语言 简单好理解
3
字母统计 题解:
4
字母统计 题解:用的map
5
字母统计 题解:用数组1到26记录出现次数;
6
字母统计 题解:map
7
字母统计 题解:c++,使用数组也能做
8
字母统计 题解:
9
字母统计 题解:
10
字母统计 题解: