当前位置:网站首页>1058 a+b in Hogwarts (20 points)
1058 a+b in Hogwarts (20 points)
2022-06-30 14:55:00 【Xue Dongjing】
1058 A+B in Hogwarts (20 branch )
The question
Give two numbers A,B, The format of the number is x1.x2.x3. among x3 This is Feng 29 Go to x2 Into one ,x2 Is every 17 Go to x1 Into one .(x1,x2,x3 They are all numbers in decimal system ). seek A+B.
Ideas
Direct addition , Each bit determines whether to carry . Pay attention to the input format .
Code
#include<stdio.h>
int main()
{
int A1,A2,A3,B1,B2,B3,C1,C2,C3,carry=0,x;
scanf("%d.%d.%d",&A1,&A2,&A3);
scanf("%d.%d.%d",&B1,&B2,&B3);
x=A3+B3;
carry=x/29;
C3=x%29;
x=A2+B2+carry;
carry=x/17;
C2=x%17;
C1=A1+B1+carry;
printf("%d.%d.%d\n",C1,C2,C3);
return 0;
}
边栏推荐
- Thinkphp5 log file contains trick
- Knowledge learned from the water resources institute project
- Database connection to company database denied
- Sorting by character frequency
- Steps for commissioning of vertical machining center
- NoViableAltException([email protected][])
- Clear the route cache in Vue
- 文本匹配——【NAACL 2021】AugSBERT
- Double pointer letter matching
- 【BUUCTF】 EasySql
猜你喜欢

Determine the number of digits of an integer in MATLAB (one line of code)

ctfshow nodejs

2021-05-12

Detailed explanation of settimeout() and setinterval()

ES6 notes

Computer screenshot how to cut the mouse in

2021-07-14 mybaitsplus

KnightCTF WEB

2021 geek challenge Web

How to realize selective screen recording for EV screen recording
随机推荐
CCF date calculation (Full Score code + skill summary) February 2, 2015
立式加工中心的数控加工对刀具使用基本要求
[buuctf] [actf2020 freshman competition]exec1
CCF window (Full Score code + problem solving idea) March 2, 2014
高精度CNC加工中心为什么会出现误差?这4个原因你要注意!
Invalid argument during startup: Failed to open the . conf file: redis-window
1135: paired base chain
Database connection to company database denied
Thinkphp5 log file contains trick
Lihongyi machine learning 2020 homework summary
LIS error: this configuration section cannot be used in this path
Examples of bubble sorting and matrix element screening in MATLAB
MV3 04_ Introducing Manifest V3
[extensive reading of papers] multimodal joint attribute prediction and value extraction for e-commerce product
Binary rotation array (2)
Sum of CCF digits (full mark code + problem solving idea) 201512-1
Computer screenshot how to cut the mouse in
Lost connection to the flow server (0 retries remaining): |Out of retries, exiting! Error reporting solution (flow)
PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available
Experiment 2: stack