hdu_5858_Hard problem(数学题)】的更多相关文章

题目链接:hdu_5858_Hard problem 题意: 让你求阴影部分面积 题解: 推推公式就行 #include<stdio.h> #include<math.h> #define PI 3.1415926535897932384626433832795 int main() { double a=1.0/8.0*PI-1.0/8.0*acos(3.0/4.0)-0.5*acos(9.0/16.0)+sqrt(7.0)/8.0; int t,l; scanf("%…
解题报告:可以说是一个纯数学题,要用到二元一次和二元二次解方程,我们假设[a,b]这个区间的所有的数的和是N,由此,我们可以得到以下公式: (b-a+1)*(a+b) / 2 = N;很显然,这是一个二元一次方程,如果可以解出这个方程里的a,b就可以了,N是已知的,那么可以怎么一个公式怎么解二元方程呢?这里有两种方法可以选择,第一种是可以枚举a = 1,2,3.....,一直枚举到N/2,a是不可能大于N/2,这个你可以自己证明一下,但是这样做的缺点就是数据量还是太大了,N/2任然达到了10的八…
http://acm.hdu.edu.cn/showproblem.php?pid=5974 遇到数学题真的跪.. 题目要求 X + Y = a lcm(X, Y) = b 设c = gcd(x, y); 那么可以表达出x和y了,就是x = i * c; y = j * c; 其中i和j是互质的. 所以lcm(x, y) = i * j * c = b 那么就得到两个方程了. i * c + j * c = a; i * j * c = b; 但是有一个c,三个未知数. 因为i和j互质,所以(i…
Problem Description Given two positive integers a and b,find suitable X and Y to meet the conditions: X+Y=a Least Common Multiple (X, Y) =b   Input Input includes multiple sets of test data.Each test data occupies one line,including two positive inte…
拉题链接  https://vjudge.net/contest/430219#overview 原题链接  https://codeforces.com/problemset/problem/340/C 前言 cf 1600的题, 直接拿来给大一的做, 感觉有亿点点难, 这是个纯数学题, 我用的排列组合方法推导 题目 题意(其实我觉得还是看上边的Note好理解) 给n个数(分别为a1, a2 ...... an-1, 把这n个数全排(共Ann 个序列)一遍, 对于每个序列, 值=每个|ai -…
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5926 题意: 给出 $N$ 行 $M$ 列的网格,每个格子内可以填入 $[1,K]$ 内的任意整数. 如果某个格子,它是它所在行上严格最大的,同时也是所在列上严格最大的,则认…
题目链接:http://codeforces.com/gym/101775/problem/A It is said that a dormitory with 6 persons has 7 chat groups ^_^. But the number can be even larger: since every 3 or more persons could make a chat group, there can be 42 different chat groups. Given N…
题目链接:https://nanti.jisuanke.com/t/30990 Alice, a student of grade 6, is thinking about an Olympian Math problem, but she feels so despair that she cries. And her classmate, Bob, has no idea about the problem. Thus he wants you to help him. The proble…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6343 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Problem DescriptionThere is a complete graph containing n vertices, the weight of the i-th vertex is wi.The length…
Problem 2125 简单的等式 Time Limit: 1000 mSec Memory Limit : 32768 KB  Problem Description 现在有一个等式如下:x^2+s(x,m)x-n=0.其中s(x,m)表示把x写成m进制时,每个位数相加的和.现在,在给定n,m的情况下,求出满足等式的最小的正整数x.如果不存在,请输出-1.  Input 有T组测试数据.以下有T(T<=100)行,每行代表一组测试数据.每个测试数据有n(1<=n<=10^18),m(…
http://acm.fzu.edu.cn/problem.php?pid=2132 N个数已经排成非递减顺序,那么每次可以取 前m->n个在x前面.取前m个在x前面的概率是 C(n,m)*x^m*(1-x)^(n-m)依次递推即可. #include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <…
题意:固定起点是0,给出一个序列表示n个点,所有点都在一条直线上,其中每个元素代表了从起点到这个点所走的距离.已知路过某个点不算到达这个点,则从起点出发,到达所有点的方案有许多种.求所有方案走的总路程/方案数,输出分子.分母,要求不含约数. e.g:n=3 {2,3,5},{2,3,5}{2,5,3}{3,2,5}{3,5,2}{5,2,3}{5,3,2},总路程(5+7+7+8+9+8)=44,答案44/6=22/3,输出“22 3”. 分析: 1.以n=3序列{a1,a2,a3}为例,实际上…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=2058 思路: 这题的n,m都很大,很显然直接暴力,会超时,那就不能全部都找了,利用等差数列求和公式, (1)sn=n*(a1+an)/2: 即可代入公式,(2)m=(e-s+1)*(s+e)/2                         注释*******//s代表起点,e代表终点. 则由(2)推出,(3)e=(int)(2*m+s*s-s),根据e点找s点,代入(1)成立则输出[s,e]; …
题目链接:http://codeforces.com/gym/101981/attachments 题意: 令 $mul(l,r) = \prod_{i=l}^{r}a_i$,且 $fac(l,r)$ 代表 $mul(l,r)$ 的不同素因子个数.求 $\sum_{i=1}^{n}\sum_{j=i}^{n}fac(i,j)$. InputThe first line contains one integer n (1 \le n \le 10^6) — the length of the se…
题意描述:给出一个n,要求在所有满足n = a+b的a和b里面求a和b的最小公倍数最大的两个数的最小公倍数. 解题报告:比赛的时候看到这个题的第一反应就是寻找这两个数一定是在a和b比较接近的地方找,这样才能保证a和b的最小公倍数最大,首先,奇数和偶数是一定要分开的讨论的,因为奇数和偶数的一半是不同的,奇数的一半可能就是所要的结果,但是偶数的一半可以确定一定不是所要的结果,因为偶数一半刚好a和b就相等了,最小公倍数就是他们本身了,这是最小的了,然后偶数里面又要分开讨论,一种是这个偶数的一半是奇数,…
一个数学问题:copy了别人的博客 #include<cstdio> #include<cstdlib> #include<cmath> int main() { int n,m,i,j; while(~scanf("%d%d",&n,&m)) { for( j=(int)sqrt(2*m); j>=1;j--) { i= (2*m/j-j+1)/2; if((i*2-1+j)*j == 2*m && i+j-1…
Fruit Ninja II Time Limit: 5000MS Memory limit: 65536K 题目描述 Have you ever played a popular game named "Fruit Ninja"? Fruit Ninja (known as Fruit Ninja HD on the iPad and Fruit Ninja THD for Nvidia Tegra 2 based Android devices) is a video game d…
A simple problem Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3702 Accepted Submission(s): 1383 Problem Description Zty很痴迷数学问题..一天,yifenfei出了个数学题想难倒他,让他回答1 / n.但Zty却回答不了^_^. 请大家编程帮助他. Input 第一行…
D. Spongebob and Squares Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599/problem/D Description Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of…
题目描述 We know thatIvan gives Saya three problems to solve (Problem F), and this is the firstproblem. "We need a programmer to help us for some projects. If you show us that youor one of your friends is able to program, you can pass the first hurdle. I…
http://acm.hdu.edu.cn/showproblem.php?pid=2522 学习://除数的运算的应用和算法.除法的本质,如果余数出现重复就表示有循环节 A simple problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2795    Accepted Submission(s): 984 Proble…
geometry  Accepts: 324  Submissions: 622  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) Problem Description There is a point PP at coordinate (x,y)(x,y). A line goes through the point, and intersects with the posti…
题目连接:http://acm.tju.edu.cn/toj/showp.php?pid=4119 4119.   HDFS Time Limit: 5.0 Seconds   Memory Limit: 5000KTotal Runs: 196   Accepted Runs: 70 In HDFS( Hadoop Distributed File System), each data may have a lot of copies in case of data lose.This pro…
题目链接 Problem Description Zty很痴迷数学问题..一天,yifenfei出了个数学题想难倒他,让他回答1 / n.但Zty却回答不了^_^. 请大家编程帮助他. Input 第一行整数T,表示测试组数.后面T行,每行一个整数 n (1<=|n|<=10^5). Output 输出1/n. (是循环小数的,只输出第一个循环节). Sample Input 4 2 3 7 168 Sample Output 0.5 0.3 0.142857 0.005952380 分析:…
两车追及或相遇问题 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 902 Accepted Submission(s): 259 Problem Description 外号叫“猪头三”的小学生在数学课上,经常遇到两车相遇或追及的方程题,经过长时间的练习,他发现了许多规律,然而他不懂计算机,他想请你帮忙编写一个计算机程序,解决他的问题.题目的…
  A simple problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2709    Accepted Submission(s): 946 Problem Description Zty很痴迷数学问题..一天,yifenfei出了个数学题想难倒他,让他回答1 / n.但Zty却回答不了^_^. 请大家编程帮助他.  …
A. Plus and Square Root 题目连接: http://codeforces.com/contest/715/problem/A Description ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) and '' (square root). Initially, the number 2 is d…
Kevin's Problem 题目连接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4921 Description In his applied probability class, Kevin learned about the Secretary Problem. There are N applicants a…
2992.357000 1000 A+B Problem1214.840000 1002 487-32791070.603000 1004 Financial Management880.192000 1003 Hangover792.762000 1001 Exponentiation752.486000 1006 Biorhythms705.902000 1005 I Think I Need a Houseboat686.540000 1011 Sticks647.566000 1007…
最重要的是找规律. 下面是引用 http://blog.sina.com.cn/s/blog_4dc813b20100snyv.html 的讲解: 做这题时,千万不要被那个图给吓着了,其实这题就是道简单的数学题. 首先看当m或n中有一个为2的情况,显然,只需要算周长就OK了.即(m+n-)*,考虑到至少其中一个为2,所以答案为2 *m或2*n,亦即m*n.注意这里保证了其中一个数位偶数. 当m,n≥3时,考虑至少其中一个为偶数的情况,显然,这种情况很简单,可以得出,结果为m*n,又可以和上面这种…