HOJ 1302 Sum of Factorials
来源:互联网 发布:王毅年轻照片知乎 编辑:程序博客网 时间:2024/05/22 15:16
http://acm.hit.edu.cn/hoj/problem/view?id=1302
问一个数能否被阶乘的和表示
0!=1
The input is terminated by a line with a negative integer.
#include <stdio.h>int f(int x){ int i, pro = 1; if(x == 0) return pro; else for(i = 1; i <= x; i++) pro *= i; return pro;}int main(){ int n; int i; int fac[10]; for(i = 0; i < 10; i++) fac[i] = f(i); while (scanf("%d", &n) != EOF) { if (n < 0) break; if (n == 0) printf("NO\n"); else { for (i = 9; i >= 0; i--) { if (n >= fac[i]) n -= fac[i]; } if(n == 0) printf("YES\n"); else printf("NO\n"); } } return 0;}
- HOJ 1302 Sum of Factorials
- Sum of Factorials
- Sum of Factorials
- Sum of Factorials
- Sum of Factorials zoj
- poj1775 - Sum of Factorials
- 1038.Sum of Factorials
- fjnu 1050 Sum of Factorials
- FOJ 1106 Sum of Factorials
- poj 1775 Sum of Factorials
- zoj 2358 Sum of Factorials
- poj 1775 Sum of Factorials
- Problem 1106 Sum of Factorials
- POJ 1775 Sum of Factorials
- ZOJ 2358 Sum of Factorials
- 题目1038:Sum of Factorials
- ZOJ 2358 Sum of Factorials
- 题目1038:Sum of Factorials
- 查询数据库死锁
- 写一个数据集DataSet---ds,向其中添加一个数据表DataTable ---dt,并创建该表的列和行。然后将本本表作为数据源绑定到GradView中。
- 获取字符串首字母拼音
- php学习笔记(七)对象操作相关
- 在网页中添加一个GradView,一个Button,一点button将MyStudents表中的数据显示在GradView中(DataSet,DataTable,List(选作))
- HOJ 1302 Sum of Factorials
- oracle数据库多表关联更新sql
- 初始化下拉列表
- combobox 筛选功能
- javascript技巧--鼠标经过时图片发生改变
- php学习笔记(八)正则表达式
- 【面向对象】parent调用父类构造函数
- vb版 dynamic用法 dynamicobject
- C#--多进程多线程访问数据库