PAT (Basic Level) Practise (中文) 1056. 组合数的和(15)
来源:互联网 发布:物联网域名注册 编辑:程序博客网 时间:2024/06/06 14:20
1056. 组合数的和(15)
时间限制
400 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
CHEN, Yue
给定N个非0的个位数字,用其中任意2个数字都可以组合成1个2位的数字。要求所有可能组合出来的2位数字的和。例如给定2、5、8,则可以组合出:25、28、52、58、82、85,它们的和为330。
输入格式:
输入在一行中先给出N(1<N<10),随后是N个不同的非0个位数字。数字间以空格分隔。
输出格式:
输出所有可能组合出来的2位数字的和。
输入样例:3 2 8 5输出样例:
330
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner input=new Scanner(System.in); int n=input.nextInt(); int arr[]=new int[n]; for (int i = 0; i < arr.length; i++) { arr[i]=input.nextInt(); } int sum=0; for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr.length; j++) { if (i!=j) { //int temp=Integer.parseInt(arr[i]+""+arr[j]); sum+=Integer.parseInt(arr[i]+""+arr[j]); } }// for (int j = arr.length-1; j > 0; j--) {// sum+=Integer.parseInt(arr[j]+""+arr[i]);// } } System.out.println(sum); }}
阅读全文
0 0
- PAT (Basic Level) Practise (中文) 1056. 组合数的和(15)
- PAT (Basic Level) Practise (中文)1056. 组合数的和(15)
- PAT BASIC LEVEL 1056. 组合数的和(15)
- PAT (Basic Level) Practise (中文)1013. 数素数 (20)
- PAT (Basic Level) Practise (中文)1013数素数 (20)
- PAT (Basic Level) Practise (中文) 1013. 数素数 (20)
- PAT (Basic Level) Practise (中文)1013. 数素数 (20)
- PAT (Basic Level) Practise (中文) 1064. 朋友数(20)
- PAT (Basic Level) Practise (中文)1002.写出这个数
- PAT (Basic Level) Practise (中文)1013. 数素数 (20)
- PAT (Basic Level) Practise (中文)1064. 朋友数(20)
- PAT (Basic Level) Practise (中文) 1079. 延迟的回文数 (20)
- PAT (Basic Level) Practise (中文) 1079. 延迟的回文数 (20)
- PAT (Basic Level) Practise (中文)
- PAT (Basic Level) Practise (中文)
- PAT (Basic Level) Practise (中文)--1001
- PAT (Basic Level) Practise (中文)
- PAT (Basic Level) Practise (中文)1001
- JS数据结构开篇:线性表和栈
- python参数传值的方式
- 深浅的拷贝
- bzoj2095 bridges 【网络流判欧拉回路】
- 2017 ACM Arabella Collegiate Programming Contest-L. All’s Wall That Ends Wall
- PAT (Basic Level) Practise (中文) 1056. 组合数的和(15)
- ECharts3.x中的点击事件与行为
- 分布式一致性算法(二)Paxos算法
- C语言(27)序号互换
- Hibernate框架学习要点(一)
- 【leetcode】542. 01 Matrix的解法总结
- 异常与线程
- 最大长方形
- 什么是XP(极限编程)