HDU_2212_水
DFS
Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7486 Accepted Submission(s): 4578
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.
2
......
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int mul[]; void calcu()
{
mul[]=;
for(int i=;i<=;i++)
mul[i]=mul[i-]*i;
} bool cmp(int x)
{
int a,tem=;
a=x;
do
{
int mm=a%;
tem+=mul[mm];
a/=;
}while(a>);
if(x==tem)
return ;
else
return ;
} int main()
{
long long num1=,num2=;
calcu();
//cout<<mul[9];
for(int i=;i<=mul[]*;i++)
{
if(cmp(i))
printf("%d\n",i);
}
return ;
}
HDU_2212_水的更多相关文章
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- Openjudge 1.13-21:最大质因子序列(每日两水)
总时间限制: 1000ms 内存限制: 65536kB 描述 任意输入两个正整数m, n (1 < m < n <= 5000),依次输出m到n之间每个数的最大质因子(包括m和n ...
- [LeetCode] Container With Most Water 装最多水的容器
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). ...
- 如何装最多的水? — leetcode 11. Container With Most Water
炎炎夏日,还是呆在空调房里切切题吧. Container With Most Water,题意其实有点噱头,简化下就是,给一个数组,恩,就叫 height 吧,从中任选两项 i 和 j(i <= ...
- Codeforces 刷水记录
Codeforces-566F 题目大意:给出一个有序数列a,这个数列中每两个数,如果满足一个数能整除另一个数,则这两个数中间是有一条边的,现在有这样的图,求最大联通子图. 题解:并不需要把图搞出来, ...
- Bzoj3041 水叮当的舞步
Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 132 Solved: 75 Description 水叮当得到了一块五颜六色的格子形地毯作为生日礼物 ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- bzoj2002弹(dan)飞绵羊 分块水过
据说是道lct求深度的题 但是在小猫大的指点下用分块就n^1.5水过了 = =数据忘记加强系列 代码极其不美观,原因是一开始是听小猫大讲的题意,还以为是弹到最前面... #include <cs ...
- bzoj1103树状数组水题
(卧槽,居然规定了修改的两点直接相连,亏我想半天) 非常水的题,用dfs序(而且不用重复,应该是直接规模为n的dfs序)+树状数组可以轻松水 收获:树状数组一遍A(没啥好骄傲的,那么简单的东西) #i ...
随机推荐
- php oop-1
<?php //类的定义以 class 关键字开始 后面跟 类的名称 通常第一个字母大写 以 大括号开始 和结束 //类的属性和方法 前面都要加关键字 例如public class NbaPla ...
- Chrome浏览器扩展开发系列之十四:本地消息机制Native messagin
Chrome浏览器扩展开发系列之十四:本地消息机制Native messaging 2016-11-24 09:36 114人阅读 评论(0) 收藏 举报 分类: PPAPI(27) 通过将浏览器 ...
- 逆向工程之App脱壳
http://www.cnblogs.com/ludashi/p/5725743.html iOS逆向工程之App脱壳 本篇博客以微信为例,给微信脱壳."砸壳"在iOS逆向工程中是 ...
- Can JavaScript connect with MySQL? 浏览器控制台的js采集数据结果持久化存储
浏览器控制台的js采集数据结果持久化存储 how to open a file in javascript https://developer.mozilla.org/en-US/docs/Web/A ...
- ASP.NET 4 and Visual Studio 2010
https://msdn.microsoft.com/en-us/library/ee532866.aspx The topics in this section provide informatio ...
- C#的内存管理知识 .
本章介绍内存管理和内存访问的各个方面.尽管运行库负责为程序员处理大部分内存管理工作,但程序员仍必须理解内存管理的工作原理,了解如何处理未托管的资源. 如果很好地理解了内存管理和C#提供的指针功能,也就 ...
- cf 749D Leaving Auction
Leaving Auction time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- Rails 拉数据初始数据库
rails c [1] pry(main)> Scraping.exec
- 题目收藏夹(啥时候一遍A啥时候删)
以下题目为没有思路或代码离谱错误或看了题解才会的,间隔一周以上再做一遍A掉就删. bzoj1500 bzoj2287 codevs1358 bzoj1725
- Django day26 HyperlinkedIdentityField,序列化组件的数据校验以及功能的(全局,局部)钩子函数,序列化组件的反序列化和保存
一:HyperlinkedIdentityField(用的很少):传三个参数:第一个路由名字,用来反向解析,第二个参数是要反向解析的参数值,第三个参数:有名分组的名字 -1 publish = ser ...