2846: 统计数字字符个数 摘要:解题思路:这道题涉及了字符串,我们就需要头文件<string.h>,按照题目要求,输入字符会包含空格,所以我们输入不再使用scanf,而是使用gets()。注意事项:在遍历数组中的字符串是,我们要明白…… 题解列表 2023年11月30日 0 点赞 0 评论 627 浏览 评分:6.0
优质题解 统计数字字符个数(C++代码解析和题解) 摘要:代码解析:首先,定义了一个函数 count_digits,它的输入参数是一个字符串 str,表示要统计的字符串。函数返回字符串中数字字符的个数。在函数内部,初始化一个计数变量 count 为0。然后,…… 题解列表 2023年07月17日 1 点赞 0 评论 1458 浏览 评分:6.3
2846: 统计数字字符个数 摘要:```cpp #include #include using namespace std; int main() { int s=0; char a[255]; …… 题解列表 2022年11月30日 0 点赞 0 评论 351 浏览 评分:8.0
统计数字字符个数(C语言代码) 摘要:解题思路:用一个循环找出字符串中在0到9之间的字符注意事项:因为调用了字符串函数,所以头文件必须要有#include<string.h>,且输入的字符串中有空格,所以要用gets()来输入字符串。参考…… 题解列表 2022年10月14日 0 点赞 0 评论 957 浏览 评分:8.8
编写题解 2846: 统计数字字符个数 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;const int N = 1e7;ch…… 题解列表 2024年07月22日 0 点赞 0 评论 851 浏览 评分:9.9
四行简便 编写题解 2846: 统计数字字符个数 摘要:解题思路:运用正则表达式注意事项:r=r'\d'参考代码:import ren=input()r=r'\d'print(len(re.findall(r,n)))…… 题解列表 2024年04月04日 0 点赞 0 评论 710 浏览 评分:9.9
分开字符串并转换与数字比较大小 摘要:解题思路:注意事项:参考代码:import java.util.Scanner; public class Main { public static void main(String[…… 题解列表 2023年11月01日 0 点赞 0 评论 436 浏览 评分:9.9
正则表达式--study||O.o 摘要:参考代码:import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; …… 题解列表 2024年02月03日 0 点赞 0 评论 326 浏览 评分:9.9
秒懂的python代码 摘要:解题思路:利用ASCII码轻松解题注意事项:要清楚记得ASCII码中数字的范围参考代码:ls=[str(i) for i in input()]cot=0for i in ls: if ord(…… 题解列表 2024年01月21日 0 点赞 0 评论 445 浏览 评分:9.9
比较常规的解题思路,挺清晰的 摘要:解题思路:注意事项:字符串中会有空格出现,用getline整行读取。参考代码:#includeusing namespace std; int main() { string s;…… 题解列表 2023年12月31日 0 点赞 0 评论 496 浏览 评分:9.9