e-olymp Problem9 N-digit numbers(打表)
传送门:点我
N-digit numbers
Find the quantity of N-digit numbers, which the sum is equal to their product. Call the least from numbers for given N (N < 10).
Input
The number N is not exceeding 10.
Output
In output file have written 2 numbers: a quantity of numbers and a less number through blank.
1
10 0 题意:给定N,询问N位数中,数的每一位相加等于每一位乘积的,有几个。然后输出第一个这样的数。
比如说如果N等于3,那么123就是一个满足条件的,因为1+2+3==1*2*3。
如果N等于4,1124是满足条件的,因为1+1+2+4==1*1*2*4。
因为N<10,我直接暴力把N<10的都打了个表。
代码:
#include <cstdio>
int main()
{
int n;
scanf("%d",&n);
if(n == ){
puts("10 0");
}
if(n == ){
puts("1 22");
}
if(n == ){
puts("6 123");
}
if(n == ){
puts("12 1124");
}
if(n == ){
puts("40 11125");
}
if(n == ){
puts("30 111126");
}
if(n ==){
puts("84 1111127");
}
if(n == ){
puts("224 11111128");
}
if(n == ){
puts("144 111111129");
}
}
e-olymp Problem9 N-digit numbers(打表)的更多相关文章
- HDOJ 1058 Humble Numbers(打表过)
Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The ...
- hdu 5676 ztr loves lucky numbers 打表+二分
ztr loves lucky numbers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/ ...
- 17115 ooxx numbers 交表
17115 ooxx numbers 时间限制:1000MS 内存限制:65535K提交次数:0 通过次数:0 题型: 编程题 语言: G++;GCC Description a number ...
- SQL Server ->> 生成Numbers辅助表
if object_id('MyDB.dbo.Numbers') is not null drop table MyDB.dbo.Numbers go use [MyDB] go create tab ...
- poj1338 Ugly Numbers 打表, 递推
题意:一个数的质因子能是2, 3, 5, 那么这个数是丑数. 思路: 打表或者递推. 打表: 若该数为丑数,那么一定能被2 或者3, 或者5 整除, 除完之后则为1. #include <ios ...
- 51nod 1010 只包含因子2 3 5的数 && poj - 1338 Ugly Numbers(打表)
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1010 http://poj.org/problem?id=1338 首先 ...
- [Swift]LeetCode902. 最大为 N 的数字组合 | Numbers At Most N Given Digit Set
We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Not ...
- 902. Numbers At Most N Given Digit Set
We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Not ...
- LeetCode902. Numbers At Most N Given Digit Set
题目: We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. ...
- [LeetCode] 902. Numbers At Most N Given Digit Set 最大为 N 的数字组合
We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Not ...
随机推荐
- contains 之 点击元素外位置隐藏元素
contains 之 点击元素外位置隐藏元素 api: contains 检测一个元素包含在另一个元素之内 详解:http://www.runoob.com/jquery/misc-contai ...
- linux驱动开发第一步hello
先查看Ubuntu的版本 cat /etc/issue lin@lin-virtual-machine:~$ cat /etc/issue Ubuntu 12.04 LTS \n \l 或者使用 li ...
- 20165304 2017-2018-2 《Java程序设计》第3周学习总结
教材学习总结 类与对象学习总结 1.类:java作为面向对象型语言具有三个特性:①封装性.②继承性.③多态性.java中类是基本要素,类声明的变量叫对象.在类中定义体的函数题叫方法. 2.类与程序的基 ...
- svn2
ubuntu下安装subversion客户端: sudo apt-get install subversion subversion-tools 详细请看 http://www.subversion. ...
- Cmake 编译opengl开源库glfw工程及使用
使用的是cmake gui进行编译的,路径输入好之后,点configure配置vs版本,这里是vs2013版本,然后如果画面出现红色的 需要再点击一下 Generate 然后直接点open proje ...
- 访问Nginx报错
今天新装Nginx,一切妥善后,访问虚拟机服务器的IP,结果发现响应超时 这是因为防火墙的80端口没有打开,在新装的Linux上搭服务器一般会遇到这个问题,重新开放80端口即可解决: (1)firew ...
- 计算机&通信词典
目录 A B C Cgroups D E F G H I J K L M N NFV NFV ISG O ONF P Q R Rewrite S T U V VNFI W X Y Z A B C Cg ...
- Tomcat 7集群基于redis的session共享设置
经过测试之后,发现是tomcat中redis相关jar包问题,替换jar包后A产品运行正常. tomcat/lib目录下将commons-pool2-2.1.jar.jedis-2.1.0.jar.t ...
- 如何在Windows下安装MYSQL,并截图说明
说明 : window 下安装 mysql 虽然简单,但是细节不注意就会安装失败,特别是配置服务器时,Current Root Password:为空:如果输入密码了在后面安装会报错.(不知道设置这个 ...
- MySQL字符集介绍及配置
目录 1.MySQL编码集 2.修改字符集 3.MySQL数据库中字符集转换流程 4.修改现有字符集 1.MySQL编码集 查看MySQL支持的字符集 mysql> show character ...