LightOJ - 1189 - Sum of Factorials】的更多相关文章

先上题目 Sum of Factorials Time Limit:500MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Description Given an integer n, you have to find whether it can be expressed as summation of factorials. For given n, you have to report a solution such…
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2109 解决:901 题目描述: John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mathematics, logic, quantum physics, meteorology, scienc…
Description John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mathematics, logic, quantum physics,meteorology, science, computers, and game theory. He wa…
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:1845 解决:780 题目描述: John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mathematics, logic, quantum physics, meteorology, scienc…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1278 题意:给你一个数n(n<=10^14),然后问n能用几个连续的数表示; 例如: 15 = 7+8 = 4+5+6 = 1+2+3+4+5,所以15对应的答案是3,有三种; 我们现在相当于已知等差数列的和sum = n, 另首项为a1,共有m项,那么am = a1+m-1: sum = m*(a1+a1+m-1)/2  -----> a1 = sum/m - (m-1)/2 a…
http://www.lightoj.com/volume_showproblem.php?problem=1278 题意:问一个数n能表示成几种连续整数相加的形式 如6=1+2+3,1种. 思路:先列式子\(N=a+(a+1)+(a+2)+ ...+(a+k-1)=\frac{k·(2a+k-1)}{2} \) 继续化成\(2a-1=\frac{2N}{k} - k \) 可由左式得知,2a-1必为奇数,那么右式必定是一奇一偶,且都为2N的因子.所以只要分解因子记录个数,最后组合求一下即可.…
http://poj.org/problem?id=1775 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1334 题目大意: 给一个数n看看n是否能够拆成几个阶乘的和 如9=1!+2!+3! 方法一: 最初想法是直接打出0~10的阶乘,10的阶乘已经大于n的范围 然后DFS,也过了.不过时间好惨... 注意n=0输出NO和0!=1 #include<cstdio> #include<cstring> con…
题目poj 题目zoj //我感觉是题目表述不确切,比如他没规定xi能不能重复,比如都用1,那么除了0,都是YES了 //算了,这种题目,百度来的过程,多看看记住就好 //题目意思:判断一个非负整数n能否表示成几个数的阶乘之和 //这里有一个重要结论:n!>(0!+1!+……+(n-1)!), //证明很容易,当i<=n-1时,i!<=(n-1)!,故(0!+1!+……+(n-1)!)<=n*(n-1)!=n!. // 由于题目规定n<=1000000,而10!=362880…
输入一个小于1000000的正整数,是否能表达成式子:a1!+a2!+a3!+...+an (a1~an互不相等). 因为10!>1000000,所以先打1~10的阶乘表.从a[10]开始递减判断.(a[0]=0!=1) #include <iostream> #include <cstdio> #include <cstring> using namespace std; int main() { //freopen("in.txt",&qu…
相关代码请戳 https://coding.net/u/tiny656/p/LightOJ/git 1006 Hex-a-bonacci. 用数组模拟记录结果,注意取模 1008 Fibsieve's Fantabulous Birthday. 找规律题,左边列是1 3平方 5平方......下边行是1 2平方 4平方......,找到当前数被包夹的位置,然后处理一下位置关系,注意奇偶. 1010 Kinghts in Chessboard. 规律题,对于m,n大于2的情况下,使用交叉放置的方法…