HDU 5879 Cure (数论)】的更多相关文章

题意:给定n,求前 n 项 1/(k*k) 的和. 析:由于这个极限是 PI * PI / 6,所以我们可以找到分界点,然后计算就好. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostre…
Cure Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1333    Accepted Submission(s): 440 Problem Description Given an integer n, we only want to know the sum of 1/k2 where k from 1 to n.   Input…
题目链接 题意:给定一个数n,求1到n中的每一项的平方分之一的累加和. 题解:题目没有给数据范围,而实际上n很大很大超过long long.因为题目只要求输出五位小数,我们发现当数大到一定程度时值是固定的 pi*pi/6.小的打表就行了,这里打表为了防止爆内存我用了优化的方法,类似于我之前写的light oj 1234. #include <iostream> #include <math.h> #include <stdio.h> #include <cstri…
Cure Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4736    Accepted Submission(s): 1100 Problem Description Given an integer n, we only want to know the sum of 1/k2 where k from 1 to n.   Inpu…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=6390 直接开始证明: 我们设…………………………………….....…...............……………...(1) 则…................................….…(2) 为什么是这样呢,因为我们知道 同理得到b的分解和的分解 我们会发现,虽然a和b的分解里可以有相等的部分,但是在里的也就是我们假设为的部分是不会有重复的,那么要由*得出也就是要去除重复部分,的重复部分就是…
给一个数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…
RGCDQ Time Limit: 3000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Submit Status Description Mr. Hdu is interested in Greatest Common Divisor (GCD). He wants to find more and more interesting things about GCD. Today He comes up with Ra…
非常可乐 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 14153    Accepted Submission(s): 5653 Problem Description 大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为.因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定…
Big Number 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1722 ——每天在线,欢迎留言谈论. 题目大意: 给你两个数 n1,n2 . 然后你有一块蛋糕,提前切好,使得不管来 n1 还是 n2 个人都能够当场平均分配. 求 “提前切好” 的最小蛋糕块数. 知识点: (请无视)公式:N = a + b + gcd(a, b) : 思路: (勿无视)先份成p块,然后再拼到一起,再从原来开始的地方,将蛋糕再分成q份,中间肯定会出现完全重合的块…
题目链接: L - LCM Walk HDU - 5584 题目大意:首先是T组测试样例,然后给你x和y,这个指的是终点.然后问你有多少个起点能走到这个x和y.每一次走的规则是(m1,m2)到(m1+lcm(m1,m2),m2)或者(m1,m2+lcm(m1,m2)). 具体思路: lcm(m1,m2)=m1*m2/(gcd(m1,m2)).然后m1就能表示成t1*gcd(m1,m2),m2能表示成t2*gcd(m1,m2).然后(m1,m2)就能走到(t1*gcd(m1,m2),t2*gcd(…