传送门:点我

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. 白鹭引擎 - 遮罩( Rectangle )

    1: 矩形遮罩 class Main extends egret.DisplayObjectContainer { /** * Main 类构造器, 初始化的时候自动执行, ( 子类的构造函数必须调用 ...

  2. javascript select标签的操作

    用原生的方法对select标签的增删操作 1.选中某一个option,一般采用 option[i].selected  = true 2.添加option首先需要创建一个option的节点,然后插入到 ...

  3. 机器学习进阶-阈值与平滑-图像平滑操作(去噪操作) 1. cv2.blur(均值滤波) 2.cv2.boxfilter(方框滤波) 3. cv2.Guassiannblur(进行高斯滤波) 4. cv2.medianBlur(进行中值滤波)

    1.cv2.blur(img, (3, 3))  进行均值滤波 参数说明:img表示输入的图片, (3, 3) 表示进行均值滤波的方框大小 2. cv2.boxfilter(img, -1, (3, ...

  4. VS2015 编译前/后拷贝文件到指定目录

    项目属性 —> Build Events —>Pre-build / Post-build event command line 中: Copy 源路径 目标路径(将路径用 " ...

  5. day28-面相对象的特殊成员、内置函数

    1. isinstance与issubclass 1.1.isinstance(obj,cls) 检查obj是否是类cls的对象,或者是类cls的子类的对象 class A: pass class B ...

  6. hadoop配置2.6.1 centos7

    上传文件(分发)的三种方式: 1.本地: -file 的模式,上传一些小的文件. 例如: -file ./test INPUT_FILE_PATH_1="/The_Man_of_Proper ...

  7. 3.有关于Python列表简述

    一..title() [让所选择的列表元素的第一个字母大写] test = ['no1','No2','No3','No4'] book = "This My " + test[0 ...

  8. ArcGIS案例学习笔记4_2_水文分析批处理地理建模

    ArcGIS案例学习笔记4_2_水文分析批处理地理建模 联系方式:谢老师,135_4855_4328,xiexiaokui#139.com 概述 计划时间:第4天下午 目的:自动化,批量化,批处理,提 ...

  9. Module build failed: Error: Cannot find module 'url-loader' 的坑

    本文地址:http://www.cnblogs.com/jying/p/8280956.html 开发环境:react.webpack.es5 引用图片报错:Module build failed: ...

  10. IIS 7配置需要注意的地方,RTX SDK运行必须Enable 32-bit Applications为True

    简单说一下IIS 7的配置里那些需要注意的 首先每个网站都必须运行在特定得程序池上,程序池的配置中,关键的几个如下图: 1. .Net Framework Version : 这个设置的是你项目用到的 ...