当前位置:网站首页>PTA 1056 sum of combinations (15 points)
PTA 1056 sum of combinations (15 points)
2022-06-24 05:11:00 【freesan44】
subject
Given N A non 0 A digit number of , Use any of them 2 Both numbers can be combined into 1 individual 2 Digit number . Require all possible combinations 2 The sum of digits . For example, given 2、5、8, You can combine :25、28、52、58、82、85, Their sum is 330.
Input format :
The input is given first in one line N(1 < N < 10), Subsequently given N A different non 0 One digit number . Numbers are separated by spaces .
Output format :
Output all possible combinations 2 The sum of digits .
sample input : 3 2 8 5 No blank lines at the end sample output : 330 No blank lines at the end
Their thinking
inputList = list(input().split())
# inputList = list("3 2 8 5".split())
count = int(inputList.pop(0))
res = 0
for index1, val1 in enumerate(inputList):
for index2, val2 in enumerate(inputList):
if index1 != index2:
# Turn one digit into ten Str Turn into int
res = res + int(str(val1+val2))
print(res)边栏推荐
- Tencent conference rest API x-tc-registered parameter policy update notification
- Spirit breath development log (15)
- [jest] summary of the use of automated test jest
- Introduction to vulnerability priority technology (VPT)
- Have you got the programmer's drawing tools and skills?
- 011_ Cascader cascade selector
- Hard core JS: there may be a memory leak in your program
- Inventory of common tools used by dry goods | data journalists
- What domain names do not need to be filed? Is there any process for domain name registration
- When remote, your resolution is lower than a × B. Some items may not be displayed on the screen
猜你喜欢

Leetcode (question 2) - adding two numbers

Popularization of children's programming education in specific scenarios

Leetcode question brushing (question 3) - the longest substring without repeated characters

CTF learning notes 17:iwesec file upload vulnerability-02 file name filtering bypass

少儿编程课程改革后的培养方式
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

What are the disadvantages of the free IP address replacement tool?

CTF learning notes 18:iwesec file upload vulnerability-03-content-type filtering bypass

011_ Cascader cascade selector

Analyzing the superiority of humanoid robot in the post human era
随机推荐
TDP members have made their debut!
How can the website be broken by CC attack?
NLP baked gluten
Use of go testing framework gomock
Share 10 creative projects of Gaoxing!
Before creating an image, it is recommended to execute the following code to purify the image as an administrator
Analysis on the subjective enthusiasm of post-90s makers' Education
How Clickhouse queries imported data within a specified time period
[jest] summary of the use of automated test jest
Disaster recovery series (IV) - disaster recovery construction of business application layer
少儿编程教育在特定场景中的普及作用
Bi-sql order by
Bi-sql - Select
GDB debugging container and command saving
CTF learning notes 18:iwesec file upload vulnerability-03-content-type filtering bypass
Analyze the actual user groups and demand positioning of distributed database products from the market and demand
Is it useful to build an industrial knowledge map platform?
CTF learning notes 17:iwesec file upload vulnerability-02 file name filtering bypass
查找GBase 8c数据库当前索引?
Inventory of common tools used by dry goods | data journalists