2846: 统计数字字符个数 ```#includeusingnamespacestd;intmain(){intcnt=0;strings;getline(cin,s);for(inti=0;i='0'&&s[i] 题解列表 2023年12月19日 0 点赞 0 评论 412 浏览 评分:0.0
莉露C++编写题解 2846: 统计数字字符个数 解题思路:getline原句,for挨个判断,sizeof(s)=strlen(s)+1,但C++不可用strlen。注意事项:if(s[i]>=48&&s[i]<=57)可写作if(s[i]>='0'&&s[i]<='9')sizeof(s)-1可写作s.size() 题解列表 2026年02月27日 0 点赞 0 评论 268 浏览 评分:0.0
2846: 统计数字字符个数 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;const int N = 1e7;ch…… 题解列表 2024年07月18日 0 点赞 0 评论 831 浏览 评分:0.0
2846: 统计数字字符个数 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;int main(){ string s…… 题解列表 2024年07月13日 0 点赞 0 评论 586 浏览 评分:0.0
2846: 统计数字字符个数 ```cpp#includeusingnamespacestd;typedeflonglongll;constintN=1e5;chara[N];intmain(){llsum=0;cin.getline(a,225);for(inti=0;i='0'&&a[i] 题解列表 2024年07月12日 0 点赞 0 评论 531 浏览 评分:0.0
2846: 统计数字字符个数 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;const int N=1e5;char a[N];int main(){ …… 题解列表 2024年07月11日 0 点赞 0 评论 594 浏览 评分:0.0
解 2846: 统计数字字符 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;char a[1005];int main(){ int sum=0; cin.g…… 题解列表 2024年07月11日 0 点赞 0 评论 533 浏览 评分:0.0
2846: 统计数字字符个数 摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;const int N=300;int main(){ int sum=0; str…… 题解列表 2023年12月19日 0 点赞 0 评论 381 浏览 评分:0.0
2846: 统计数字字符个数 摘要:解题思路:注意事项:要输入字符0到字符9参考代码:#include <bits/stdc++.h>using namespace std;char s[100000];int main(){ i…… 题解列表 2023年10月28日 0 点赞 0 评论 485 浏览 评分:0.0
优质题解 统计数字字符个数(C++代码解析和题解) 摘要:代码解析:首先,定义了一个函数 count_digits,它的输入参数是一个字符串 str,表示要统计的字符串。函数返回字符串中数字字符的个数。在函数内部,初始化一个计数变量 count 为0。然后,…… 题解列表 2023年07月17日 1 点赞 0 评论 1999 浏览 评分:6.3