HDU2212 DFS 2016-07-24 13:52 56人阅读 评论(0) 收藏
DFS
Problem Description
For example ,consider the positive integer 145 = 1!+4!+5!, so it's a DFS number.
Now you should find out all the DFS numbers in the range of int( [1, 2147483647] ).
There is no input for this problem. Output all the DFS numbers in increasing order. The first 2 lines of the output are shown below.
Input
Output
Sample Output
1
2
......
——————————————————————————————————————————
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std; int main()
{ int a[10],k,sum,s; a[0]=1;
for(int i=1;i<10;i++)
{
a[i]=1;
for(int j=1;j<=i;j++)
{
a[i]*=j;
}
} for(int i=1;i<100000;i++)
{
s=i;
sum=0;
while(s>0)
{
k=s%10;
sum+=a[k];
s/=10;
}
if(sum==i)
printf("%d\n",i);
}
return 0;
}
HDU2212 DFS 2016-07-24 13:52 56人阅读 评论(0) 收藏的更多相关文章
- Hadoop1.2.1伪分布模式安装指南 分类: A1_HADOOP 2014-08-17 10:52 1346人阅读 评论(0) 收藏
一.前置条件 1.操作系统准备 (1)Linux可以用作开发平台及产品平台. (2)win32只可用作开发平台,且需要cygwin的支持. 2.安装jdk 1.6或以上 3.安装ssh,并配置免密码登 ...
- Red and Black(BFS or DFS) 分类: dfs bfs 2015-07-05 22:52 2人阅读 评论(0) 收藏
Description There is a rectangular room, covered with square tiles. Each tile is colored either red ...
- HDU1312 Red and Black(DFS) 2016-07-24 13:49 64人阅读 评论(0) 收藏
Red and Black Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total ...
- HDU1045 Fire Net(DFS枚举||二分图匹配) 2016-07-24 13:23 99人阅读 评论(0) 收藏
Fire Net Problem Description Suppose that we have a square city with straight streets. A map of a ci ...
- HDU1181 变形课(DFS) 2016-07-24 13:31 73人阅读 评论(0) 收藏
变形课 Problem Description 呃......变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒 ...
- select document library from certain list 分类: Sharepoint 2015-07-05 07:52 6人阅读 评论(0) 收藏
S using System; using Microsoft.SharePoint; namespace Test { class ConsoleApp { static void Main(str ...
- POJ1087 A Plug for UNIX 2017-02-12 13:38 40人阅读 评论(0) 收藏
A Plug for UNIX Description You are in charge of setting up the press room for the inaugural meeting ...
- 百度地图-省市县联动加载地图 分类: Demo JavaScript 2015-04-26 13:08 530人阅读 评论(0) 收藏
在平常项目中,我们会遇到这样的业务场景: 客户希望把自己的门店绘制在百度地图上,通过省.市.区的选择,然后加载不同区域下的店铺位置. 先看看效果图吧: 实现思路: 第一步:整理行政区域表: 要实现通过 ...
- 棋盘问题 分类: 搜索 POJ 2015-08-09 13:02 4人阅读 评论(0) 收藏
棋盘问题 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28474 Accepted: 14084 Description 在一 ...
随机推荐
- threading实例
import paramiko, threading import queue import pymysql class ThreadPool(object): def __init__(self, ...
- 单点登录(SSO)解决方案之 CAS客户端与Spring Security集成
接上篇:单点登录(SSO)解决方案之 CAS服务端数据源设置及页面改造 Spring Security Spring Security是一个能够为基于Spring的企业应用系统提供声明式的安全访问控制 ...
- springboot+cxf 开发webservice
参考 https://www.cnblogs.com/fuxin41/p/6289162.html pom.xml <?xml version="1.0" encoding= ...
- Educational Codeforces Round 58
D. GCD Counting 题意: 给出n个点的树,每个点有一个权值,找出一条最长的路径使得路径上所有的点的gcd>1 题解: gcd>1的一定不会有很多.所以暴力搞一下就行,不需要点 ...
- Find Peak Element(ARRAY - Devide-and-Conquer)
QUESTION A peak element is an element that is greater than its neighbors. Given an input array where ...
- Island Transport
Island Transport http://acm.hdu.edu.cn/showproblem.php?pid=4280 Time Limit: 20000/10000 MS (Java/Oth ...
- PS切图导出代码后出现的图片布局散乱的解决方法——table布局
前言: 一般来说,大部分美工PS切图后导出的都是使用PS默认的table布局的页面,出现最多的异常是上传代码,替换图片后,发现图片布局散乱,完全不是想要的效果.轻微的是浏览器不兼容,只有部分浏览器可以 ...
- HTML实例
HTML内容繁多,不易记忆,故将此网址 作为查阅复习的工具http://www.w3school.com.cn/example/html_examples.asp
- vsftp 500 OOPS: cannot change directory:/home/xyp
1.在linux终端下输入: > setsebool ftpd_disable_trans 1 (*如果出现Could not change active booleans: Invalid b ...
- NOIP 2016 游记