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 ...
随机推荐
- JS call和apply方法使用
总是对call和apply方法使用存在迷惑,特此记录一下 一句话理解这两个方法: call和apply是为了动态改变this而出现的,当一个object没有某个方法,但是其他的有,我们可以借助call ...
- 爬虫--Scrapy-基于RedisSpider实现的分布式爬虫
爬取网易新闻 需求:爬取的是基于文字的新闻数据(国内,国际,军事,航空) 先编写基于scrapycrawl 先创建工程 scrapy startproject 58Pro cd 58Pro 新建一个爬 ...
- ABAP-计算器-动态表达式
data:lv_value type string. call function 'EVAL_FORMULA' exporting formula = '90 <= 90' program = ...
- Runloop原理
简单的说,runloop是一个事件循环的机制,同时能够保活线程.iOS中每个线程都对应一个runloop,主线程的runloop默认开启,其他线程的runloop默认关闭,线程与runloop是一一对 ...
- spark遇到的错误1-内存不足
原来的代码: JavaRDD<ArticleReply> javaRdd = rdd.flatMap(new FlatMapFunction<String, ArticleReply ...
- 【367】通过 python 实现 SVM 硬边界 算法
参考: 支持向量机整理 SVM 硬边界的结果如下: $$min \quad \frac{1}{2} \sum_{i=1}^m\sum_{j=1}^m \alpha_i\alpha_jy_iy_j \v ...
- 【358】GitHub 上面文件夹下载方法
参考:https://www.bilibili.com/read/cv210500/ 参考:https://www.jianshu.com/p/743ecc20ffb2 软件下载:Downloads ...
- Linux awk命令使用方法
awk是linux上非常好用的文本处理工具,常用于指定列的处理,包括获取指定列的内容.根据指定列匹配关系输出等文本处理.本文主要描述awk命令的基本语法.正则表达式与操作符的使用.常用内置变量的含义和 ...
- 安装vue CLI后, 出现安装权限问题
问题:安装vue CLI后,出现:npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/usr/l ...
- 创建maven项目前的准备工作
第二步: 在maven中的settings.xml文件中指定 2.1 本地仓库:计算机中一个文件夹,自己定义是哪个文件夹. 2.1 示例语法 <localRepository>D:/mav ...