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;
}
相关推荐
Tisfy9 分钟前
LeetCode 3643.垂直翻转子矩阵:原地修改
算法·leetcode·矩阵·模拟
噜啦噜啦嘞好10 分钟前
算法篇:滑动窗口
数据结构·算法
无限进步_14 分钟前
【C++】单词反转算法详解:原地操作与边界处理
java·开发语言·c++·git·算法·github·visual studio
吗~喽20 分钟前
【C++】模板的两大特性
c++
泯泷21 分钟前
从零构建寄存器式 JSVMP:实战教程导读
前端·javascript·算法
NGC_661122 分钟前
值传递和引用传递辨析
算法
王璐WL24 分钟前
【C++】string类基础知识
开发语言·c++
笑鸿的学习笔记24 分钟前
qt-C++语法笔记之Qt中的delete ui、ui的本质与Q_OBJECT
c++·笔记·qt
寒月小酒32 分钟前
3.21 OJ
算法·深度优先
Book思议-35 分钟前
【数据结构考研真题】链表大题
c语言·数据结构·考研·算法·链表·408·计算机考研