Làm thế nào để bạn tìm thấy hai chữ số đầu tiên của một số trong python?

Chương trình phải chấp nhận một số nguyên N làm đầu vào. Chương trình phải in hiệu tuyệt đối giữa hai chữ số đầu tiên và hai chữ số cuối cùng trong N làm đầu ra

[Các] Điều kiện biên.
10^3

Định dạng đầu vào.
Dòng đầu tiên chứa giá trị của N.

Định dạng đầu ra.
Dòng đầu tiên ghi hiệu tuyệt đối giữa hai chữ số đầu và hai chữ số cuối của N.

Ví dụ Đầu vào/Đầu ra 1.
Đầu vào.
21546

Đầu ra.
25

Giải thích.
Hai chữ số đầu tiên trong 21546 là 21.
Hai chữ số cuối cùng trong 21546 là 46.
Hiệu tuyệt đối của 21 và 46 là 25.

Ví dụ Đầu vào/Đầu ra 2.
Đầu vào.
351684617

Đầu ra.
18

input_n=input[].strip[]
num1=input_n[0:2]
num2=input_n[-2:]
num1,num2=int[num1],int[num2]
print[abs[num1-num2]]

Đăng lại

Phản ứng của bạn là gì?

Kinh ngạc

0

đang yêu

1

Rất hữu ích

0

vỗ tay

0

  • chữ số

01626

Cho số nguyên dương N [ít nhất chứa hai chữ số]. Nhiệm vụ là viết chương trình Python để cộng chữ số đầu tiên và chữ số cuối cùng của số N đã cho

ví dụ

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
Input: N = 73
Output: 10

Phương pháp 1. Triển khai chuỗi

  • Lấy đầu vào ở dạng Chuỗi hoặc đánh máy đã cho đầu vào ở dạng Chuỗi
  • Bây giờ, chọn chỉ mục thứ 0 của Chuỗi và nhập nó vào Số nguyên và lưu trữ nó trong một biến
  • Điều tương tự với chỉ mục -1 và cũng lưu trữ trong một biến khác
  • Bây giờ thêm hai biến này và
  • in chúng dưới dạng Đầu ra

Ghi chú. Chúng ta có thể truy cập phần tử đầu tiên của Chuỗi bằng chuỗi [0] và phần tử cuối cùng của Chuỗi bằng chuỗi [-1]

Biểu diễn chuỗi


Python3




Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
50

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
51
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
52
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
53

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
54

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
51
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
52
Input: N = 73
Output: 10
0
Input: N = 73
Output: 10
1

 

Input: N = 73
Output: 10
2

Input: N = 73
Output: 10
3

Input: N = 73
Output: 10
4
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
52
Input: N = 73
Output: 10
6
Input: N = 73
Output: 10
7
Input: N = 73
Output: 10
8
Input: N = 73
Output: 10
9

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
20
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
52
Input: N = 73
Output: 10
6
Input: N = 73
Output: 10
7
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
24
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
25
Input: N = 73
Output: 10
9

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
27

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
28
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
52
Input: N = 73
Output: 10
4
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
501
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
20

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
503

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
504
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
505____1506
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
507

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
508
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
509

đầu ra

Cộng chữ số đầu và chữ số cuối của số là 8

Độ phức tạp về thời gian. O[1] kể từ khi thực hiện các hoạt động liên tục

Không gian phụ trợ. O[1] vì sử dụng không gian cố định cho các biến

Phương pháp 2. Giải nó bằng một số nguyên

  • Chúng tôi đã đưa ra một số nguyên dương
  • Sau khi chia cho 10, lưu trữ phần còn lại trong một biến kết quả
  • Tiếp tục vòng lặp cho đến khi số nhỏ hơn 9
  • Mỗi lần trong vòng lặp, chia số cho 10 [chia số nguyên]
  • Sau khi kết thúc vòng lặp
  • Thêm số vào biến kết quả
  • Hiển thị biến kết quả dưới dạng đầu ra

Ghi chú. Bất cứ khi nào chúng tôi chia bất kỳ số nào cho 10, chúng tôi nhận được chữ số cuối cùng là phần còn lại. Nếu chia một số bất kỳ cho 100 thì dư hai chữ số tận cùng

Input: N = 73
Output: 10
25 ________ 2261
Input: N = 73
Output: 10
257 ________ 2289
Input: N = 73
Output: 10
20
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6862
Input: N = 73
Output: 10
264
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6916
Input: N = 73
Output: 10
289
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
707
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6867

 

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6869

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
28
Input: N = 73
Output: 10
29

 

Input: N = 73
Output: 10
274

Input: N = 73
Output: 10
248
Input: N = 73
Output: 10
276

Input: N = 73
Output: 10
25

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
278

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
28
Input: N = 73
Output: 10
281
Input: N = 73
Output: 10
282
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
707
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
708

 

Input: N = 73
Output: 10
285

________ 2261 ________ 2257 ________ 2234 ________ 1752

Input: N = 73
Output: 10
290
Input: N = 73
Output: 10
291____2257
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
682
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
708

Input: N = 73
Output: 10
290
Input: N = 73
Output: 10
296

 

Input: N = 73
Output: 10
297

C#




Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6898

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6899

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
80
Input: N = 73
Output: 10
201

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
806
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6957

Input: N = 73
Output: 10
25

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
75

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
843
Input: N = 73
Output: 10
20
Input: N = 73
Output: 10
21
Input: N = 73
Output: 10
20
Input: N = 73
Output: 10
23

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
24

Input: N = 73
Output: 10
22____16902

Input: N = 73
Output: 10
22
Input: N = 73
Output: 10
20
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6905____220
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8021

Input: N = 73
Output: 10
25

Input: N = 73
Output: 10
22____16911

Input: N = 73
Output: 10
22
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6913____220____16982
Input: N = 73
Output: 10
20
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8030

Input: N = 73
Output: 10
25

Input: N = 73
Output: 10
22____16919

________ 222 ________ 228 ________ 229

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
930

Input: N = 73
Output: 10
25

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
931

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
843
Input: N = 73
Output: 10
20
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
933
Input: N = 73
Output: 10
20
Input: N = 73
Output: 10
23

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
24

Input: N = 73
Output: 10
22____1938

Input: N = 73
Output: 10
22
Input: N = 73
Output: 10
28
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
691

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
930

Input: N = 73
Output: 10
25

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
693

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
805
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
843
Input: N = 73
Output: 10
227
Input: N = 73
Output: 10
259

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
24

Input: N = 73
Output: 10
22
Input: N = 73
Output: 10
20
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
699

Input: N = 73
Output: 10
22
Input: N = 73
Output: 10
266

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8072
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
682
Input: N = 73
Output: 10
240

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
930

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
930

 

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8078

PHP




Input: N = 73
Output: 10
274

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
93

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
69

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
75

Input: N = 73
Output: 10
278
Input: N = 73
Output: 10
21____2280
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
708

Input: N = 73
Output: 10
24

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6902

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8091
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8092
Input: N = 73
Output: 10
280
Input: N = 73
Output: 10
218

 

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6911

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
280
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8099
Input: N = 73
Output: 10
280
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8401
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8091
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8403

 

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6919

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
28
Input: N = 73
Output: 10
280
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
752

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
930

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
931

Input: N = 73
Output: 10
278
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
933____2280
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
708

Input: N = 73
Output: 10
24

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
938

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
28
Input: N = 73
Output: 10
289
Input: N = 73
Output: 10
280
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
9316

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
930

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
9318

________ 2280 ________ 19320

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
9321
Input: N = 73
Output: 10
21____2280
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8431
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
682
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8433

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
9327
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
933____2280
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8437
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
9331____1752

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8440

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8441

Javascript




Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
9335

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8443

Input: N = 73
Output: 10
276

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
75

________ 2278 ________ 19342

Input: N = 73
Output: 10
24

Input: N = 73
Output: 10
25

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6902

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8453

 

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6911

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8457

 

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
6919

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
28
Input: N = 73
Output: 10
29

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
930

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
931

Input: N = 73
Output: 10
278
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8466

Input: N = 73
Output: 10
25

Input: N = 73
Output: 10
25
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
938

Input: N = 73
Output: 10
25
Input: N = 73
Output: 10
28
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8472

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
930

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
9318

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
9379

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8476
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
682
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
708

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8479
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8480
Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
708

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
8482

 

Input: N = 1247
Output: 8

Explanation: First digit is 1 and Last digit is 7. 
So, addition of these two [1 + 7] is equal to 8.
9388

Đầu ra

Input: N = 73
Output: 10
2

Độ phức tạp về thời gian. O[1]
Không gian phụ. Ô[1]

Lưu ý quan trọng. log10[] là một hàm toán học có trong toán học. tập tin tiêu đề h. Nó trả về giá trị log cơ số 10 của tham số đã truyền cho hàm log10[].  

Chủ Đề