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;
}
相关推荐
炸膛坦客31 分钟前
单片机/C/C++八股:(二十)指针常量和常量指针
c语言·开发语言·c++
I_LPL1 小时前
hot100贪心专题
数据结构·算法·leetcode·贪心
颜酱1 小时前
DFS 岛屿系列题全解析
javascript·后端·算法
WolfGang0073212 小时前
代码随想录算法训练营 Day16 | 二叉树 part06
算法
炸膛坦客2 小时前
单片机/C/C++八股:(十九)栈和堆的区别?
c语言·开发语言·c++
2401_831824963 小时前
代码性能剖析工具
开发语言·c++·算法
是wzoi的一名用户啊~3 小时前
【C++小游戏】2048
开发语言·c++
Sunshine for you4 小时前
C++中的职责链模式实战
开发语言·c++·算法
qq_416018724 小时前
C++中的状态模式
开发语言·c++·算法
2401_884563244 小时前
模板代码生成工具
开发语言·c++·算法