当前位置:网站首页>1016 part a+b
1016 part a+b
2022-06-29 04:11:00 【Lele ~ll】
Positive integer A Of “DA( by 1 An integer ) part ” Defined by A All in DA A new integer composed of PA. for example : Given A=3862767,DA=6, be A Of “6 part ”PA yes 66, because A There is 2 individual 6.
Now given A、DA、B、DB, Please write a program to calculate PA+PB.
Input format :
The input is given in turn on a line A、DA、B、DB, Space between , among 0<A,B<109.
Output format :
Output in one line PA+PB Value .
sample input 1:
3862767 6 13530293 3
sample output 1:
399
sample input 2:
3862767 1 13530293 8
sample output 2:
0The code is as follows :
#include<stdio.h>
int main()
{
int a, a1, b, b1,i,k1=0,k2=0,j;
scanf("%d %d %d %d", &a, &a1, &b, &b1);
int ma = 0, mb = 0;// Sum up
for (i = 0; a > 0; a /= 10)
if (a % 10 == a1)
k1++;
for (i = 0; b > 0; b /= 10)
if (b % 10 == b1)
k2++;
for (j = 0; j < k1; j++)
ma = ma * 10 + a1;
for (j = 0; j < k2; j++)
mb = mb * 10 + b1;
printf("%d", ma + mb);
return 0;
}边栏推荐
- Why is the test post a giant pit? The 8-year-old tester told you not to be fooled
- Runtimeerror in yolox: dataloader worker (PID (s) 17724, 1364, 18928) exited unexpectedly
- 干货丨微服务架构是什么?有哪些优点和不足?
- MySQL column to row conversion without Union
- JSX的基本使用
- [new function] ambire wallet integrates Metis network
- Build a simple website by yourself
- PostgreSQL has a cross database references are not implemented bug
- PostgreSQL 出现cross-database references are not implemented的bug
- [filter design] customize the filter with MATLAB according to the design index
猜你喜欢

访问数据库时出现错误

Apifox : 不仅是Api调试工具,更是开发团队的协作神器

科班出身,结果外包都不要

Technology cloud report: side B of mixed office: how to have both security and efficiency?

What is the dry goods microservice architecture? What are the advantages and disadvantages?
![[new function] ambire wallet integrates Metis network](/img/29/8a8c0cd40c51cef1174ee59706d4c9.png)
[new function] ambire wallet integrates Metis network

【FPGA+sin】基于DDS(直接数字合成)的正弦信号发生器模块FPGA实现

Why are you a test / development programmer? Can you recall

SQL 数据记录如何上下行合并

树莓派用VNC Viewer方式远程连接
随机推荐
1016 部分A+B
【Laravel系列8】走出 Laravel 的世界
Technology: how to design zkvm circuit
[FPGA mathematical formula] use FPGA to realize common mathematical formulas
Web crawler knowledge day04
String differences between different creation methods
Ling Jing thinks about her own way
不使用union实现Mysql 列转行
Is the sink usually the JDBC insert update delete?
多机局域网办公神器 rustdesk 使用强推!!!
Multi machine LAN office artifact rustdesk use push!!!
yolox出现 RuntimeError: DataLoader worker (pid(s) 17724, 1364, 18928) exited unexpectedly
HCIE-Security Day41:理论学习:信息收集与网络探测
增额终身寿险下架了吗?现在还有哪些增额终身寿险产品?
2022年 6月27号 《暑假感悟篇一》路程的选择权。
自己动手搭建一个简单的网站
1019 数字黑洞
If I hadn't talked to Ali P7, I wouldn't know I was a mallet
基于可变参模板实现的线程池
[Brillouin phenomenon] Study on simultaneous measurement system of Brillouin temperature and strain distribution in optical fiber