56-题目1087:约数的个数
来源:互联网 发布:intent传递int数据 编辑:程序博客网 时间:2024/05/19 22:02
http://ac.jobdu.com/problem.php?pid=1087
输入n个整数,依次输出每个数的约数的个数
#include<iostream>#include<fstream>#include<math.h>using namespace std;int main(){int n, num;ifstream cin("data.txt");while (cin >> n && n != 0){for (; n > 0; n--){cin >> num;int count = 0, j;for (j = 1; j < sqrt(num) + 1 && j <= num / j; j++){if (num == 1)count++;else if (num % j == 0){if (j == num / j)count++;elsecount += 2;}}cout << count << endl;}}system("pause");return 0;}
0 0
- 56-题目1087:约数的个数
- 题目1087:约数的个数
- 题目1087:约数的个数
- 题目1087:约数的个数
- 题目1087:约数的个数
- 题目1087:约数的个数
- 题目1087:约数的个数
- 题目1087:约数的个数
- 题目56:约数的个数
- [WA]题目1087:约数的个数
- 九度题目1087:约数的个数
- 九度题目1087约数的个数
- 九度题目1087:约数的个数
- 九度 题目1087:约数的个数
- 九度OJ—题目1087:约数的个数
- 九度oj 题目1087:约数的个数
- 九度OJ 题目1087:约数的个数
- 九度 oj 题目1087:约数的个数
- ALGO-124数字三角形 动态规划
- poj 2142 The Balance(扩展欧几里德算法)
- 228. Summary Ranges
- 629A.Far Relative’s Birthday Cake
- C++ 按指定分隔符拆分字符串
- 56-题目1087:约数的个数
- [C]LeetCode:Maximum Depth of Binary Tree
- 慕课网Zepto.js课程学习笔记
- 常用网络管理操作
- Java网络编程——InetAddress
- 寻找 tableview 中的最后一行|自动滚动到最后一行
- 【高性能】linux加载当前目录的动态库
- 【数据结构】线性表(链表实现)
- 正则表达式的学习(二)