首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
数字阶梯求和
[编程题]数字阶梯求和
热度指数:12458
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 64M,其他语言128M
算法知识视频讲解
给定a和n,计算a+aa+aaa+a...a(n个a)的和。
输入描述:
测试数据有多组,输入a,n(1<=a<=9,1<=n<=100)。
输出描述:
对于每组输入,请输出结果。
示例1
输入
1 10
输出
1234567900
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(20)
邀请回答
收藏(98)
分享
提交结果有问题?
86个回答
21篇题解
开通博客
健康快乐最重要
发表于 2020-02-08 12:31:03
#include<iostream> #include<string> #include<algorithm> using namespace std; //此题类似于快速幂和大数乘法,大数加法的结合 //大数加法 string addString(stri
展开全文
philos
发表于 2021-03-13 15:51:02
大数加法,要用到字符串去存数字,其实也蛮简单的,因为先对齐位置,再进行加减就好了,其中存好每一次的进位 carry,每一次进行相加的有 i 个 a #include<iostream> #include<cmath> using namespace std; int ma
展开全文
吃葡萄不爱吐葡萄皮
发表于 2024-03-22 16:24:27
#include <stdio.h> int main() { int a,n; scanf("%d %d",&a,&n); int temp_a[200]={0},sum[200]={0},top,c; for(in
展开全文
czz__zzz
发表于 2025-03-31 19:57:21
#include<iostream> #include<vector> #include<cmath> using namespace std; int main() { char a; int n; cin >> a >> n;
展开全文
牛客440904392号
发表于 2024-10-07 13:44:24
//C++版代码 #include <iostream> using namespace std; int main() { int a, n; while (cin >> a >> n) { string sum;
展开全文
leventsg
发表于 2024-03-04 18:23:37
#include <iostream> #include <bits/stdc++.h> using namespace std; vector<int> add(vector<int> &a,vector<int> &b
展开全文
尤姆
发表于 2023-03-03 20:22:26
#include<cstdio> #include<vector> using namespace std; int main(){ int a, n; while (scanf("%d %d", &a, &n) != EOF){ vector<int>
展开全文
牛客892450047号
发表于 2024-01-31 21:04:39
#include <iostream> using namespace std; #include<vector> #include<math.h> vector<int> add(vector<int>a,vector<int&g
展开全文
Huster水仙
发表于 2023-01-17 22:05:57
按照算式顺序,依次初始化各个加数,用大数加法累加 #include<iostream> #include<string> using namespace std; string add_str(string a,string b){//字符串相加 string c
展开全文
黄金回旋02
发表于 2025-03-22 15:01:22
#include <bits/stdc++.h> using namespace std; int main() { int a, n; while (cin >> a >> n) { // 注意 while 处理多个 case
展开全文
问题信息
模拟
基础数学
难度:
86条回答
98收藏
10635浏览
热门推荐
通过挑战的用户
查看代码
大牛来了_
2023-03-12 10:45:22
_cherry
2023-02-28 10:16:30
Lu1912
2023-02-20 21:28:19
牛客49234...
2023-02-10 15:35:55
想回学校的悲伤...
2023-01-21 10:59:43
相关试题
有两个文件context.txt和...
去哪儿
模拟
评论
(4)
线段树编号问题
基础数学
评论
(2)
一个文件里有10万个随机正整数,按...
去哪儿
堆
模拟
评论
(4)
如图 1 表示使用快表(页表)的虚...
编程基础
评论
(1)
订单表order_table全部记...
查找
数据库
数据分析
SQL
评论
(2)
数字阶梯求和
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
1 10
1234567900