传送门:点我

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.

Time limit 1 second
Memory limit 64 MiB
Input example #1
1
Output example #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(打表)的更多相关文章

  1. HDOJ 1058 Humble Numbers(打表过)

    Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The ...

  2. hdu 5676 ztr loves lucky numbers 打表+二分

    ztr loves lucky numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/ ...

  3. 17115 ooxx numbers 交表

    17115 ooxx numbers 时间限制:1000MS  内存限制:65535K提交次数:0 通过次数:0 题型: 编程题   语言: G++;GCC Description a number ...

  4. SQL Server ->> 生成Numbers辅助表

    if object_id('MyDB.dbo.Numbers') is not null drop table MyDB.dbo.Numbers go use [MyDB] go create tab ...

  5. poj1338 Ugly Numbers 打表, 递推

    题意:一个数的质因子能是2, 3, 5, 那么这个数是丑数. 思路: 打表或者递推. 打表: 若该数为丑数,那么一定能被2 或者3, 或者5 整除, 除完之后则为1. #include <ios ...

  6. 51nod 1010 只包含因子2 3 5的数 && poj - 1338 Ugly Numbers(打表)

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1010 http://poj.org/problem?id=1338 首先 ...

  7. [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 ...

  8. 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 ...

  9. 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'}.  ...

  10. [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 ...

随机推荐

  1. 静态方法@staticmethod

    staticmethod 返回函数的静态方法.该方法不强制要求传递参数,名义上在类里面归类管理,但是不能使用类的变量和实例的变量是类的工具包 如下声明一个静态方法: class Room: t = 1 ...

  2. MiniDao支持ID自增主键策略,使用讲解

    用法示例: /** * 插入数据(ID采用自增策略,并返回自增ID) * @param employee */ @IdAutoGenerator(generator="native" ...

  3. day07-多表查询

    本节重点: 多表连接查询 符合条件连接查询 子查询 准备工作:准备两张表,部门表(department).员工表(employee) create table department( id int, ...

  4. flash推流工具<转>

    https://github.com/young-cowboy/young-cowboy.github.io https://www.cnblogs.com/xiaoniuzai/p/7129036. ...

  5. Django权限auth模块详解

    转自:http://www.cnblogs.com/Finley/p/5575305.html 1,auth模块是Django提供的标准权限管理系统,可以提供用户身份认证,用户组和权限管理 2,aut ...

  6. Tesseract-OCR4.0版本在VS2015上的编译与运行(转)

    最近刚开始接触识别库引擎方面的知识,由于项目中需要使用光学识别处理模块,在老师与朋友的推荐下,我开始接触tesseract光学识别库,在最开始从GitHub上下载的源代码进行编译的时候,出现了许多意想 ...

  7. unity 脚本说明

    MonoBehavour void OnEnable(){ //OnEnable执行在Wake和之前 } void Awake(){ // } void Start(){ } void OnEnabl ...

  8. wx小程序自定义组件与页面之间参数传递

    在开发中,很多页面中会使用相同的组件,这时可以将具有相同信息的部分封装成一个组件,方便开发中调用.在调用中可能会涉及到数据的传递问题,例如页面与组件,组件与组件直接的数据传递. 首先看看页面与组件直接 ...

  9. nth-child与nth-of-type区别

    示例详细理解:nth-child(n)与:nth-of-type(n)区别 childselector:nth-child(index) 1,子选择器(childselector,这里是p选择器)选中 ...

  10. Nodejs 菜鸟教程学习-创建第一个应用

    注:为了解学习,都是参照http://www.runoob.com/nodejs/nodejs-tutorial.html书写,做下笔记. 对于Nodejs开发来说,在开发一个应用时,我们不仅仅是实现 ...