传送门:点我

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. 选择、操作web元素

    11月1日 什么是web元素 Selenium自动化主要就是:选择界面元素,操作界面元素(输入操作:点击.输入文字.拖拽等,输出操作:获取元素的各种属性),根据界面上获取的数据进行分析和处理 选择元素 ...

  2. Deque 双端队列 Stack 堆栈

    1. peek 获取栈顶元素 pop   删除栈顶元素

  3. linux 源码编译php的参数

    ./configure --prefix=/usr/local/php-5.3.5 --with-config-file-path=/usr/local/php-5.3.5/etc --with-co ...

  4. cxVerticalGrid赋值是实时更新

    procedure TForm1.cxVerticalGrid1Edited(Sender: TObject; ARowProperties: TcxCustomEditorRowProperties ...

  5. Python3.7中urllib.urlopen 报错问题

    import urllib web = urllib.urlopen('https://www.baidu.com') f = web.read() print(f) 报错: Traceback (m ...

  6. 10:处理 json

    json 通用的数据类型, 所有的语言都认识.json 是字符串.key-value 必须使用双引号1. loads() 和 dumps() 的使用 json.loads() 将 json 字符串转换 ...

  7. 关于 SAXParseException Content is not allowed in Prolog (前言中不允许有内容)

    解析 XML 文件的时候,如 Mybatis 的 Mapper 文件,有时会出现 org.xml.sax.SAXParseException 前言中不允许有内容 的异常,英文就是 Content is ...

  8. vscode项目配置 vue-loader-webpack

    使用vsCode进行项目配置 一.准备工作 1.下载Visual Studio Code 下载地址 2.打开vscode,根据自己需求下载相应插件,可以提高工作效率. 点击下角选项(我作了红框标记), ...

  9. pandas库的数据类型运算

    pandas库的数据类型运算 算数运算法则 根据行列索引,补齐运算(不同索引不运算,行列索引相同才运算),默认产生浮点数 补齐时默认填充NaN空值 二维和一维,一维和0维之间采用广播运算(低维元素与每 ...

  10. poj1061-青蛙的约会-(贝祖定理+扩展欧几里得定理+同余定理)

    青蛙的约会 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions:132162   Accepted: 29199 Descripti ...