首页
比赛
题库
课程
竞赛讨论区
登录
/
注册
去牛客
首页
>
字符统计
14条解析
开通博客写题解
李华plus
发表于 2021-10-16 11:37:22
C标准中有一个一个头文件<ctype.h>,这里面定义了一批C语言字符处理函数,用于测试字符是否属于特定的字符类别 #include<stdio.h> #include<ctype.h> int main() { &nbs
展开全文
我是一只小肚肚
发表于 2021-02-23 14:08:26
注意小心边界值,字母还要考虑大写 int main() { char a; int Letters = 0, Digits = 0, Others = 0; while ((a = getchar()) != '?') { if ((a >= '
展开全文
晨曦挣大钱
发表于 2020-09-24 10:17:03
python Letters = 0 Digits = 0 Others = 0 x = input() for i in x: if i.isdigit(): Digits += 1 elif i.isalpha(): Letters += 1
展开全文
frlpp
发表于 2021-05-30 14:36:19
#include <bits/stdc++.h> using namespace std; int main() { char c; c = getchar(); int Letters = 0,Digits = 0,Others = 0; while
展开全文
Codecodify
发表于 2023-05-18 16:41:48
通过ascii码表来对比整数大小,当然这解法不简洁,看评论的解法都挺优雅的。 #include <stdio.h> int main() { int letters = 0, digits = 0, others = 0, assic = 0; char c;
展开全文
牛客517072235号
发表于 2021-08-02 16:01:46
#include<iostream> using namespace std; int main() { char a; int l=0, d=0, o=0; do { a=getchar(); if((a>='a'&
展开全文
杨离
发表于 2021-10-18 20:22:52
暴力求解 #include<stdio.h> #include<string.h> int main(){ char a[100]; gets(a); int i=0; while(a[i]!='?'){ i++; } int zm=0,s
展开全文
Kennywu
发表于 2024-12-30 15:35:10
// 使用 %[^\n] 来读取整行输入,包括空格 #include<stdio.h> #include<string.h> int main(){ char s[1000];
展开全文
Lysss_
发表于 2024-03-02 14:11:41
#include <cctype> using namespace std; int main() { int Letters = 0,Digits = 0,Others = 0; char a; cin.get(a); while (a != '?')
展开全文
AmzingWork
发表于 2023-04-11 13:32:24
代码如下: #include <iostream> using namespace std; char ch; int cnt[3]; int classify(char ch) { if (ch >= 'A' && ch <= 'Z' || ch &
展开全文
查看本题
查看本题讨论
相关比赛
17037-阿尔法ACM协会训练赛002
进入比赛
18296-信息编程学习-基础练习
进入比赛
18388-暑假第一周Java基础训练
进入比赛
18811-阿尔法-C++暑期日常练习
进入比赛
18857-阿尔法-C++暑期第二期上机测试1
进入比赛
等你来战
查看全部
福建师范大学第二十二届程序设计竞赛(同步赛)
报名截止时间:2025-05-18 14:00
牛客周赛 Round 93
报名截止时间:2025-05-18 21:00
衡阳师范学院第二十五届程序设计竞赛(同步赛)
报名截止时间:2025-06-08 18:00
2025牛客暑期多校训练营1
报名截止时间:2025-07-15 17:00
扫描二维码,关注牛客
意见反馈
下载牛客APP,随时随地刷题