acm_数学问题
文章平均质量分 80
kongming_acm
kongming_acm
展开
-
1833 排列
排列Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 8218 Accepted: 3693 Description题目描述: 大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3,1 3 2,2 1 3,2 3 1,3 1 2,3 2 1六个排列。 任务描述: 给出某个排列,求出这个排列的下k个排列,如果遇到最后一个原创 2010-07-15 15:46:00 · 799 阅读 · 0 评论 -
1423 Big Number n!的位数
Big NumberTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 15616 Accepted: 4931<br />DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, e原创 2010-07-14 23:32:00 · 472 阅读 · 0 评论 -
3070 Fibonacci 二分
FibonacciTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3459 Accepted: 2426<br />Description<br />In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence a原创 2010-07-16 14:07:00 · 410 阅读 · 0 评论 -
非齐次线性方程组 北师大oj
J: 非齐次线性方程组<br />Time Limit: 1000 ms Case Time Limit: 1000 ms Memory Limit: 65536 KB<br />Submit: 9 Accepted: 6 <br />Description<br /> <br />我们知道,对于一个非齐次线性方程组,知道它的矩阵后,我们可以判断出该方程组的解的状况。 <br />那么,假设我们知道这么一个矩阵,且矩阵大小为n*(n-1),请编程求出该矩阵对应的非齐次线性方程组的解。原创 2010-07-16 15:04:00 · 940 阅读 · 0 评论 -
2480 Longge's problem 欧拉函数变形 求,∑gcd(i, N)
Longge's problemTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3822 Accepted: 1128DescriptionLongge is good at mathematics and he likes to think about hard mathematical problems which will be solved by some graceful algorithms. Now a problem com原创 2010-07-16 17:05:00 · 1147 阅读 · 0 评论 -
2299 Ultra-QuickSort 归并排序求逆序数
Ultra-QuickSortTime Limit: 7000MS Memory Limit: 65536KTotal Submissions: 15456 Accepted: 5446DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent原创 2010-07-13 15:34:00 · 462 阅读 · 0 评论 -
1394 Minimum Inversion Number 逆序数 N个数排列
Minimum Inversion Number<br />Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 724 Accepted Submission(s): 386<br /><br />Problem DescriptionThe inversion number of a given number sequence a1,原创 2010-07-13 18:17:00 · 440 阅读 · 0 评论 -
1256 Anagram 全排列 next_permutation 用法
AnagramTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 11921 Accepted: 4877<br />DescriptionYou are to write a program that has to generate all possible words from a given set of letters. <br />Example: Given the word "abc", your program should -原创 2010-07-15 00:21:00 · 446 阅读 · 0 评论 -
X倍数问题
<br />X倍数问题 Time Limit:100 ms | Memory Limit:10000 KB<br />Submit:334 (167 users) | Accepted:155 (136 users)Description 若一个整数Y的个位数为X,将X移到最高位得到的恰好是Y的X倍,称Y为一个X倍数。例如,0是一个0倍数,1是一个1倍数。Input 无Output 请依次输出最小的0倍数、1倍数、2倍数、……9倍数。每个X倍数输出一行。Sample Input 无Sample Output原创 2010-07-15 10:03:00 · 1644 阅读 · 0 评论 -
3210 Coins
CoinsTime Limit: 1000MS Memory Limit: 131072KTotal Submissions: 5002 Accepted: 3207<br />Description<br />Snoopy has three coins. One day he tossed them on a table then and tried to flip some of them so that they had either all heads or all tails facing up原创 2010-07-18 23:16:00 · 480 阅读 · 0 评论 -
World Cup
<br />World Cup<br />Time Limit: 1000 ms Case Time Limit: 1000 ms Memory Limit: 65536 KB<br />Submit: 4 Accepted: 3 <br />Description<br /><br />A World Cup of association football is being held with teams from around the world. The standing is原创 2010-07-18 23:16:00 · 495 阅读 · 0 评论 -
tyvj 1040 表达式计算
FromAdmin表达式计算 描述 Description 给出一个表达式,其中运算符仅包含+,要求求出表达式的最终值<br /><br /><br /> 输入格式 Input Format 仅一行,即为表达式<br /> 输出格式 Output Format 仅一行,既为表达式算出的结果 样例输入 Sample Input 1+1 样例输出 Sample Output 2 时间限制 Time Limita原创 2010-07-23 23:33:00 · 1268 阅读 · 0 评论 -
tyvj 1041 表达式计算2
FromAdmin表达式计算2 描述 Description 给出一个表达式,其中运算符仅包含+,-,要求求出表达式的最终值<br /><br />保证数据中不会出现负数。<br /><br /> 输入格式 Input Format 仅一行,即为表达式<br /> 输出格式 Output Format 仅一行,既为表达式算出的结果 样例输入 Sample Input 1+1-1 样例输出 Sample Output 1原创 2010-07-23 23:34:00 · 575 阅读 · 0 评论 -
hdu 1008 Count 101 n个0-1串的种类,不能包括101
Count 101Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 267 Accepted Submission(s): 106 Problem DescriptionYou know YaoYao is fond of his chains. He has a lot of chains and each chain has n原创 2010-08-01 19:25:00 · 834 阅读 · 0 评论 -
2142 The Balance 拓展欧几里德,求|x|+|y|最小值
The BalanceTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 1628 Accepted: 691<br />DescriptionMs. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine. For example, to measure 200mg of aspirin using 300mg原创 2010-08-02 23:16:00 · 732 阅读 · 0 评论 -
2478 Farey Sequence 求欧拉函数,利用素数筛选法
<br />#include<iostream><br />#include<stdio.h><br />using namespace std;<br />int a[1000005];<br />long long sum[1000005];<br />void phi_table(int n , int * phi)//筛选法求欧拉函数<br />{<br /> for(int i=2 ; i<= n; i++) phi[i] = 0;<br /> phi[1]= 1;<br /> for(int i原创 2010-08-03 21:17:00 · 488 阅读 · 0 评论 -
1061 青蛙的约会 拓展欧几里德 求x的最小正数解
青蛙的约会Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 50990 Accepted: 7487<br />Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除原创 2010-08-03 22:30:00 · 582 阅读 · 0 评论 -
2478 Farey Sequence 求欧拉函数,利用递推公式
Farey SequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6416 Accepted: 2316<br />DescriptionThe Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 < a < b <= n and gcd(a,b) = 1 arranged in原创 2010-08-03 10:40:00 · 585 阅读 · 0 评论 -
2689 Prime Distance 素数筛选法, 筛选一段区间的素数
Prime DistanceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4098 Accepted: 1097<br />DescriptionThe branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticia原创 2010-08-03 09:53:00 · 494 阅读 · 0 评论 -
spoj 5971 LCM SUM 求∑lcm(i,n)
<br />spoj 5971. LCM Sum<br />Problem code: LCMSUM <br /><br />Given n, calculate the sum LCM(1,n) + LCM(2,n) + .. + LCM(n,n), where LCM(i,n) denotes the Least Common Multiple of the integers i and n.<br /> <br />Input<br /> <br />The first line contains T原创 2010-08-08 19:28:00 · 1430 阅读 · 0 评论 -
错排列公式
<br />错排公式:<br />错排公式<br />目录<br />错排公式的由来<br />递推的方法推导错排公式<br />容斥原理<br />简化公式<br /> <br />错排公式的由来<br /> pala提出的问题: 十本不同的书放在书架上。现重新摆放,使每本书都不在原来放的位置。有几种摆法?<br /> 这个问题推广一下,就是错排问题: n个有序的元素应有n!种不同的排列。如若一个排列式的所有的元素都不在原来的位置上,则称这个排列为错排。<br />递推的方法推导错排公式<br />原创 2010-08-08 19:30:00 · 1167 阅读 · 0 评论 -
uva 11424 GCD Extreme 求∑∑gcd(i,j) (1<i<n,i<j<n)
<br />Problem H<br />GCD Extreme<br />Input: Standard Input<br />Output: Standard Output <br /> <br />Given the value of N, you will have to find the value of G. The definition of G is given below:<br /><br /> <br />Here GCD(i,j) means the greatest common原创 2010-08-08 20:37:00 · 3920 阅读 · 0 评论 -
zoj 32686 Very Simple Counting 求因子个数
<br />Very Simple Counting<br />--------------------------------------------------------------------------------<br />Time Limit: 1 Second Memory Limit: 32768 KB <br />--------------------------------------------------------------------------------<br原创 2010-08-11 18:59:00 · 493 阅读 · 0 评论 -
hdu 1394 Minimum Inversion Number 归并排序求逆序数 求一串数的最小逆序数
Minimum Inversion Number<br />Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 927 Accepted Submission(s): 514<br /><br />Problem DescriptionThe inversion number of a given number sequence a1,原创 2010-08-13 10:58:00 · 484 阅读 · 0 评论 -
Tile Code 拼木板
<br />3904 - Tile Code<br />Asia - Seoul - 2007/2008 <br />PDF Submit Ranking <br /> <br />The city of Songpa is now carrying out a project to build a bicycle transportation system called 鈥榞reen Songpa.鈥?By the end of this year, citizens and visitors a原创 2010-08-14 21:39:00 · 605 阅读 · 0 评论 -
3233 Matrix Power Series 求矩阵 S = A + A2 + A3 + … + Ak 二分 矩阵模板
Matrix Power SeriesTime Limit: 3000MS Memory Limit: 131072KTotal Submissions: 6040 Accepted: 2579<br />Description<br />Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak.<br />Input<br />The input contains exactly one t原创 2010-08-14 22:00:00 · 544 阅读 · 0 评论 -
3696 The Luckiest number 最小X整数倍数 大整数质因数分解及欧拉函数,dfs求大整数的所有约数
The Luckiest numberTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2349 Accepted: 537<br />Description<br />Chinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has his own lucky number L. Now he wants to constr原创 2010-08-22 22:21:00 · 911 阅读 · 0 评论 -
2429 GCD & LCM Inverse 大整数分解质因数
GCD & LCM InverseTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3966 Accepted: 680<br />DescriptionGiven two positive integers a and b, we can easily calculate the greatest common divisor (GCD) and the least common multiple (LCM) of a and b. But原创 2010-08-22 22:19:00 · 1119 阅读 · 0 评论 -
Miller-Rabin素数检测优化算法及其证明
<br />http://wenku.baidu.com/view/6b26bc23482fb4daa58d4b79.html<br />东北师范大学硕士学位论文 里面讲解非常详细<br />原创 2010-08-21 16:46:00 · 858 阅读 · 0 评论 -
3101 Astronomy Java大数,分数的最小公倍数
AstronomyTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 2704 Accepted: 553<br />Description<br />There are n planets in the planetary system of star X. They orbit star X in circular orbits located in the same plane. Their tangent velocities are原创 2010-08-21 11:42:00 · 661 阅读 · 0 评论 -
1811 Prime Test Miller_Rabin素数测试,pollard_rho大整数分解 求大整数的最小质因子
Prime TestTime Limit: 6000MS Memory Limit: 65536KTotal Submissions: 16552 Accepted: 3310Case Time Limit: 4000MSDescriptionGiven a big integer number, you are required to find out whether it's a prime number.InputThe first line contains the number of test c原创 2010-08-21 16:17:00 · 744 阅读 · 0 评论 -
zoj 3386 Trick or Treat 求x轴上一点到各点的最大值中的最小值 点到线段距离 三分
Trick or Treat--------------------------------------------------------------------------------Time Limit: 5 Seconds Memory Limit: 65536 KB Special Judge --------------------------------------------------------------------------------Johnny and hi原创 2010-08-28 22:33:00 · 1097 阅读 · 2 评论 -
hdu 2352 Max Angle 极角排序
Max Angle<br />Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)<br />Total Submission(s): 342 Accepted Submission(s): 128<br /><br />Problem DescriptionGiven many points in a plane, two players are playing an interesti原创 2010-08-29 16:44:00 · 871 阅读 · 0 评论 -
北航1033 Easy Problem 点到线段最短距离 三分法
<br />Easy Problem<br />时间限制:1000 ms | 内存限制:65536 KB <br />描述 <br />In this problem, you're to calculate the distance between a point P(xp, yp, zp) and a segment (x1, y1, z1) ? (x2, y2, z2), in a 3D space, i.e. the minimal distance from P to any point Q(原创 2010-08-28 22:33:00 · 717 阅读 · 0 评论 -
2002 Squares 平面点集能组成多少正方形 哈希表
SquaresTime Limit: 3500MS Memory Limit: 65536KTotal Submissions: 8065 Accepted: 2718<br />DescriptionA square is a 4-sided polygon whose sides have equal length and adjacent sides form 90-degree angles. It is also a polygon such that rotating about its cen原创 2010-09-13 20:44:00 · 660 阅读 · 0 评论 -
ACM again- Ancient China Mathematics again 表达式计算 只有+和*和括号
<br />ACM again- Ancient China Mathematics again<br />TimeLimit: 1 Second MemoryLimit: 32 Megabyte <br />Totalsubmit: 368 Accepted: 31 <br />Description<br />ACM again- Ancient China Mathematics again<br />ACM again- Ancient China Mathematics again<b原创 2010-09-10 21:43:00 · 714 阅读 · 0 评论 -
1971 Parallelogram Counting 平面点集能组成多少个平行四边形 中点排序
Parallelogram CountingTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 3709 Accepted: 1149<br />DescriptionThere are n distinct points in the plane, given by their integer coordinates. Find the number of parallelograms whose vertices lie on these原创 2010-09-13 19:38:00 · 718 阅读 · 0 评论 -
hdu 3625 Examining the Rooms 第一类斯特林数
Examining the Rooms<br />Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)<br />Total Submission(s): 182 Accepted Submission(s): 89<br /><br />Problem DescriptionA murder happened in the hotel. As the best detective in原创 2010-09-13 18:53:00 · 824 阅读 · 0 评论 -
hdu 3629 Convex 平面点集能组成多少凸四边形 极角排序
Convex<br />Time Limit: 10000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)<br />Total Submission(s): 369 Accepted Submission(s): 79<br /><br />Problem DescriptionYour task is very simple. You will get the coordinates of n points in原创 2010-09-14 12:42:00 · 1937 阅读 · 4 评论 -
成都预赛 Polar intersecting line segments 已知N个线段,判断是否相交 排序+划分区间
Polar intersecting line segments<br />Time Limit: 1000 MS Memory Limit: 65536 K<br />Description<br />In this problem, you are asked to determine if a set of line segments intersect.Input<br />The first line of input is a number c ≤ 20, the number of tes原创 2010-09-15 21:04:00 · 1158 阅读 · 0 评论