Hdu 1299】的更多相关文章

题目链接:hdu 1299 Diophantus of Alexandria 题意: 给你一个n,让你找1/x+1/y=1/n的方案数. 题解: 对于这种数学题,一般都变变形,找找规律,通过打表我们可以发现这个答案只与这个数的因子有关. n=a1^p1*a2^p2*...*an^pn ans=((1+2*p1)*(1+2*p2)*...*(1+2*pn)+1)/2 #include<bits/stdc++.h> #define F(i,a,b) for(int i=a;i<=b;++i)…
给一个数n问有多少种x,y的组合使$\frac{1}{x}+\frac{1}{y}=\frac{1}{n},x<=y$满足,设y = k + n,代入得到$x = \frac{n^2}{k} + n$,也就是求n^2的因子数量 /** @Date : 2017-09-08 10:45:12 * @FileName: HDU 1299 数论 分解.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link…
Diophantus of Alexandria Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2326    Accepted Submission(s): 887 Problem Description Diophantus of Alexandria was an egypt mathematician living in Ale…
Diophantus of Alexandria Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2269    Accepted Submission(s): 851 Problem Description Diophantus of Alexandria was an egypt mathematician living in Ale…
1/x + 1/y = 1/n 1<=n<=10^9给你 n 求符合要求的x,y有多少对 x<=y// 首先 x>n 那么设 x=n+m 那么 1/y= 1/n - 1/(n+m)// 1/y = m/(n*n+n*m) 所以满足 n*n|m 的m都是可以的 // 问题转化成求n*n 的约数个数 因数分解 然后用求约数个数公式// 最后答案记得 除 2 因为重复算了#include <iostream> #include <algorithm> #inclu…
Diophantus of Alexandria was an egypt mathematician living in Alexandria. He was one of the first mathematicians to study equations where variables were restricted to integral values. In honor of him, these equations are commonly called diophantine e…
方法一:朴素算法:O(n). #include<bits/stdc++.h> using namespace std; int get_num(int n){ ; ;i<=n;++i) )num++; return num; } int get_sum(int n){ ; ;i<=n;++i) )tot+=i; return tot; } int main(){ int n; while(cin>>n){ cout<<get_num(n)<<en…
题意:等式 1 / x + 1 / y = 1 / n (x, y, n ∈ N+ (1) 且 x <= y) ,给出 n,求有多少满足该式子的解.(1 <= n <= 1e9) 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1299 分析:x,y肯定都满足 n<x<=y; 设 x = n + k; 带入上式得 :1/y = k/(n2+n*k); 即 k要整除 (n2+n*k); 又 k 一定整除 n*k; 即求 k 整除 n…
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 1084 1088 1106 1107 1113 1117 1119 1128 1129 1144 1148 1157 1161 1170 1172 1177 1197 1200 1201…
X问题 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2980    Accepted Submission(s): 942 Problem Description 求在小于等于N的正整数中有多少个X满足:X mod a[0] = b[0], X mod a[1] = b[1], X mod a[2] = b[2], …, X mod…