zoj1204-addtive eqations(加法算式)
来源:互联网 发布:淘宝简装纸尿裤能用吗 编辑:程序博客网 时间:2024/05/13 19:05
ZOJ Problem Set - 1204:Additive equations
Time Limit: 10 Seconds Memory Limit: 32768 KBWe all understand that an integer set is a collection of distinct integers. Now the question is: given an integer set, can you find all its addtive equations? To explain what an additive equation is, let's look at the following examples:
1+2=3 is an additive equation of the set {1,2,3}, since all the numbers that are summed up in the left-hand-side of the equation, namely 1 and 2, belong to the same set as their sum 3 does. We consider 1+2=3 and 2+1=3 the same equation, and will always output the numbers on the left-hand-side of the equation in ascending order. Therefore in this example, it is claimed that the set {1,2,3} has an unique additive equation 1+2=3.
It is not guaranteed that any integer set has its only additive equation. For example, the set {1,2,5} has no addtive equation and the set {1,2,3,5,6} has more than one additive equations such as 1+2=3, 1+2+3=6, etc. When the number of integers in a set gets large, it will eventually become impossible to find all the additive equations from the top of our minds -- unless you are John von Neumann maybe. So we need you to program the computer to solve this problem.Input
The input data consists of several test cases.
The first line of the input will contain an integer N, which is the number of test cases.
Each test case will first contain an integer M (1<=M<=30), which is the number of integers in the set, and then is followed by M distinct positive integers in the same line.Output
Sample Input
For each test case, you are supposed to output all the additive equations of the set. These equations will be sorted according to their lengths first( i.e, the number of integer being summed), and then the equations with the same length will be sorted according to the numbers from left to right, just like the sample output shows. When there is no such equation, simply output "Can't find any equations." in a line. Print a blank line after each test case.33 1 2 33 1 2 56 1 2 3 5 4 6
Output for the Sample Input
1+2=3Can't find any equations.1+2=31+3=41+4=51+5=62+3=52+4=61+2+3=6
Source: Zhejiang University Local Contest 2002, Preliminary
- zoj1204-addtive eqations(加法算式)
- 加法算式
- 加法算式
- ZOJ1204
- zoj1204
- 高精度算式计算(加法和乘法)
- LeetCode 306 addtive number
- 算式
- ZOJ1204(dfs)
- (zoj1204)Additive equations
- 1-9九个数字不重复组成一个三位数加法算式,求出所有组合
- 1-9九个数字不重复组成一个三位数加法算式,求出所有组合
- zoj1204给01串排序
- LeetCode(306) Addtive Number解题报告
- 如下的加法算式:其中每个汉字代表一个数字,填写“让我怎能过大年” 所代表的整数。
- C++第4次实验(基础班)—循环结构程序设计(参考答案)-项目7-4:加法算式
- 加法
- 加法
- CSS模板与HTML模板实用于每次新开发页面使用
- android SDK的安装
- 2010年年终总结
- Fundmental Metrics
- shell 脚本FTP自动上传文件
- zoj1204-addtive eqations(加法算式)
- How to disable flush of ASH data to AWR?
- Gartner Business Intelligence 08年Gartner商务智能平台魔法四分区
- 正则表达式(初识笔记)
- Android通过共享用户ID来实现多Activity进程共享
- 二值图像轮廓提取
- Business Intelligence Software Product
- 汇编语言学习小结(第十章和第十一章)
- 介绍 .Net工具Code Snippet 与 Sql Server2008工具SSMS Tools Pack