C++二级题2

数字字符求和

cpp 复制代码
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<iomanip>
#include<cmath>
#include<bits/stdc++.h>
int a[2000][2000];
int b[2000];
char c[2000];
long long n;
using namespace std;
int main()
{
	cin>>c;
	n=strlen(c);
	int q=0;
	for(int i=0;i<n;i++)
	{
		if(c[i]<='9'&&c[i]>='0')
		{
			b[q]=(char)c[i];
			q++;
		}
	}
	int sum=0;
	for(int i=0;i<q;i++)
	{
		sum=(sum+b[i])/25;
	}
	cout<<sum;
	return 0;
}

简单密码

不会
2023.03 二级」进阶的卡莎
不会
合影效果不会
g圆

cpp 复制代码
#include<bits/stdc++.h>
using namespace std;
int main() 
{
	char a[100];int l,s=0;
	gets(a);
    l=strlen(a);
	for(int i=0;i<l;i++)
	{
		if(a[i]>='1'&&a[i]<='9')
		{
			s=s+a[i]-48;  
		}
	}
	cout<<s;
	return 0;
}
相关推荐
Sakinol#10 小时前
Leetcode Hot 100 ——多维动态规划
算法·leetcode·动态规划
xsyaaaan10 小时前
leetcode-hot100-二叉树
数据结构·leetcode
XZXZZX10 小时前
ATCODER ABC 450 C题解
c++·算法·ccf csp
堕27410 小时前
JavaEE初阶——《多线程--. 多线程带来的的⻛险-线程安全 (重点)》
java·算法·java-ee
像素猎人10 小时前
差分数组【自用笔记】【c++】
c++·笔记·算法
_日拱一卒10 小时前
LeetCode:无重复字符的最长字串
算法·leetcode·职场和发展
kyle~11 小时前
ROS2 Control
c++·嵌入式硬件·机器人·ros2
xiaoye-duck11 小时前
《算法题讲解指南:优选算法-哈希表》--58.存在重复元素I,59.存在重复元素II,60.字母异位词分组
数据结构·c++·哈希算法
hetao173383711 小时前
2026-03-26 ZYZ28-CSP-XiaoMao Round 2 hetao1733837 的 record
c++·算法
dazzle11 小时前
机器学习算法原理与实践-入门(九):基于TensorFlow框架的线性回归
算法·机器学习·tensorflow