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;
}
相关推荐
放羊郎6 小时前
基于ORB-SLAM2算法的优化工作
人工智能·算法·计算机视觉
mask哥6 小时前
力扣算法java实现汇总整理(上)
java·算法·leetcode
如果'\'真能转义说7 小时前
OOXML 文档格式剖析:哈希、ZIP结构与识别
xml·算法·c#·哈希算法
夏日听雨眠7 小时前
数据结构(栈和队列)
数据结构
王老师青少年编程8 小时前
csp信奥赛C++高频考点专项训练之字符串 --【子串查找】:[NOIP 2009 提高组] 潜伏者
c++·字符串·csp·高频考点·信奥赛·子串查找·潜伏者
梦梦代码精8 小时前
BuildingAI 上部署自定义工作流智能体:5 个实用技巧
大数据·人工智能·算法·开源软件
初願致夕霞8 小时前
基于系统调用的Linux网络编程——UDP与TCP
linux·网络·c++·tcp/ip·udp
Zephyr_09 小时前
Leedcode算法题
java·算法
流年如夢10 小时前
栈和列队(LeetCode)
数据结构·算法·leetcode·链表·职场和发展