![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM数学
文章平均质量分 61
utoppia
这个作者很懒,什么都没留下…
展开
-
hdu 1284 钱币兑换问题
题目描述:钱币兑换问题Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3147 Accepted Submission(s): 1769Problem Description在一个国家仅有1分,2分原创 2012-10-17 23:19:07 · 326 阅读 · 0 评论 -
CERC_2008_Tower(hdu 2971)
PRO IS HERE由 a(n) = 2*a(2)*a(n-1) - a(n-2)let p = 2*a(2);==>a(n) =p*a(n-1) - a(n-2)==>a(n)^2 = p^2*a(n-1)^2 - 2*p*a(n-1)*a(n-2) + a(n-2)^2................(1)let s(n) =sum(a(i) );s原创 2013-04-16 20:51:27 · 834 阅读 · 0 评论 -
Uva 10294 Arif in Dhaka (First Love Part 2)
PRO题目大意: n 个珠子组成的 项链,t 种颜色去染, 问有多少本质不同的项链;经旋转,翻转一样的视为同一种项链。就是一个简单的polya组合计数的应用,算出每种置换的循环节个数,答案就是《组合数学》 P393 的公式;因为题目的量比较小,直接暴搞就可以了,答案保证不会超64位,所以就没有必要高精度了。秀一下。。。原创 2013-04-15 11:02:45 · 762 阅读 · 0 评论 -
Uva 10288 - Coupons
自己写的正数分数类,也作为红书第一题,留念。。。alpc 加油。#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)#define nMax 1010#define inf 0x原创 2013-04-15 00:26:16 · 736 阅读 · 0 评论 -
sgu 193 Chinese Girls' Amusement
193. Chinese Girls' Amusementtime limit per test: 0.5 sec.memory limit per test: 65536 KBinput: standardoutput: standardYou must have heard that the Chinese culture is quite differ原创 2012-11-06 23:18:13 · 4104 阅读 · 0 评论 -
sgu 178 Golden chain
178. Golden chaintime limit per test: 0.5 sec.memory limit per test: 4096 KBinput: standardoutput: standardPeter arrived to the city and stayed in the hotel. He has no money but fe原创 2012-11-07 19:37:18 · 563 阅读 · 0 评论 -
sgu 169 Numbers
169. Numberstime limit per test: 0.5 sec.memory limit per test: 4096 KBinput: standardoutput: standardLet us call P(n) - the product of all digits of number n (in decimal notation)原创 2012-11-06 15:43:39 · 443 阅读 · 0 评论 -
sgu 196 Matrix Multiplication
196. Matrix Multiplicationtime limit per test: 0.5 sec.memory limit per test: 65536 KBinput: standardoutput: standardLet us consider an undirected graph G = which has N vertices a原创 2012-11-07 00:26:01 · 507 阅读 · 0 评论 -
sgu 114 Telecasting station
题目描述:114. Telecasting stationtime limit per test: 0.5 sec. memory limit per test: 4096 KBEvery city in Berland is situated on Ox axis. The government of the country decided to build ne原创 2012-10-26 10:31:12 · 458 阅读 · 0 评论 -
SGU_511_Fermat's Last Theorem
PRO IS HEREx^n + y^n = z^n (mod p)假设p的原根是r我们设 x=r^a,y=r^b,z=r^c;原方程化为r^an + r^bn = r^cn (mod p)令R=r^n设a=> 1 + R^(b-a) = R^(c-a) (mod p) (c>=a)或者R^(a-c) + R^(b-c) = 1 (mod p)原创 2013-07-29 17:09:01 · 1206 阅读 · 5 评论 -
Uva 10217
题目大意就是每次转一个n面的色子,问哪个位置会转出已经出现的点数的概率最大。第i个位置转出已经出现的点数的概率是:Pi = (N-1)! / i! / N^(N-i) ;P(i+1) / P(i) = (N-i+1)*i/(i-1)/N ==> i= ......最后的答案就是 (-1+sqrt(1+4N))/2 #include#includei原创 2013-08-23 13:39:12 · 794 阅读 · 0 评论 -
HDU 1817 , POJ 1286
polya // hdu 1817 poj 1286// by utoppia// polya#includetypedef long long ll;ll pow(ll a,int n) { ll ret = 1ll; while(n--) ret *= a; return ret;}int gcd(int a,int b) { retur原创 2014-04-22 16:16:57 · 869 阅读 · 0 评论 -
模板,FFT 快速傅里叶变化
大神的模板。。原创 2014-04-21 20:17:32 · 4563 阅读 · 0 评论 -
模板,扩展,离散对数,数论
扩展版的离散对数基本思路还是基于Shank的大小步算法(Shank's Baby-St原创 2014-04-22 12:01:13 · 727 阅读 · 0 评论 -
一些有意思的网站
找规律的 oeis.org原创 2014-04-21 10:55:11 · 620 阅读 · 0 评论 -
CSU 1416 Practical Number 很有意思的数学题
基本上就是一个结论题,然后wiki一下就出了// csu 1416// by utoppia// http://planetmath.org/PracticalNumber// http://en.wikipedia.org/wiki/Practical_number// http://oeis.org/A005153#include#include#include#inc原创 2014-04-21 12:12:24 · 965 阅读 · 0 评论 -
Uva 11802
题意就是给定n,k问n在b进制下最后k未都是0假设 b = p1^a1 .....那么 a1*k 我们记录每个质数的个数,然后就用f(k+1)-f(k)#include#include#includeusing namespace std;#define nMax 9000int p[nMax];long long k;long long原创 2013-08-23 21:47:50 · 818 阅读 · 0 评论 -
SGU 497. Abelian Groups
SGU 497497. Abelian GroupsTime limit per test: 0.5 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardAndrew has just made a breakthrough in group theory: he reali原创 2013-08-23 20:12:08 · 765 阅读 · 0 评论 -
UvaLive 3964 - A Foldy but a Goody
每次折叠都是坐标的90度旋转。。。从后往前处理。#include#include#include#include#includeusing namespace std;#define nMax 40char s[nMax];int m;class P {public: int x,y; P() {}; P(int x,int y):x(x),y(y原创 2013-08-23 14:48:11 · 764 阅读 · 0 评论 -
sgu 113 Nearly prime numbers
题目描述:113. Nearly prime numberstime limit per test: 0.5 sec. memory limit per test: 4096 KBNearly prime number is an integer positive number for which it is possible to find such primes原创 2012-10-26 09:07:18 · 402 阅读 · 0 评论 -
sgu 154 Factorial
154. Factorialtime limit per test: 0.5 sec.memory limit per test: 4096 KBinput: standard inputoutput: standard outputYou task is to find minimal natural number N, so that N! contai原创 2012-11-05 02:07:04 · 364 阅读 · 0 评论 -
sgu 135 Drawing Lines
题目描述:135. Drawing Linestime limit per test: 0.5 sec. memory limit per test: 4096 KBLittle Johnny likesto draw a lot. A few days ago he painted lots of straight lines on hissheet of pap原创 2012-11-01 22:24:37 · 425 阅读 · 0 评论 -
sgu 126 Boxes
126. Boxestime limit per test: 0.5 sec. memory limit per test: 4096 KBThere are two boxes. There are A balls in the first box, and B balls in the second box (0 < A + B < 2147483648). It is pos原创 2012-11-01 00:35:51 · 398 阅读 · 0 评论 -
sgu 123 The sum
题目描述:123. The sumtime limit per test: 0.5 sec. memory limit per test: 4096 KBThe Fibonacci sequence of numbers is known: F1 = 1; F2 = 1; Fn+1 = Fn + Fn-1, for n>1.You have to find S原创 2012-10-31 22:14:20 · 394 阅读 · 0 评论 -
sgu 112 ab-ba
题目:112. ab-batime limit per test: 0.5 sec. memory limit per test: 4096 KBYou are given natural numbers a and b. Find ab-ba.InputInput contains numbers a and b (1≤a,b≤100).Outpu原创 2012-10-30 18:50:36 · 1024 阅读 · 0 评论 -
sgu 120 Archipelago
120. Archipelagotime limit per test: 0.5 sec. memory limit per test: 4096 KBArchipelago Ber-Islands consists ofN islands that are vertices of equiangular and equilateral N-gon. Islands are c原创 2012-10-30 23:50:24 · 642 阅读 · 0 评论 -
sgu 119 Magic Pairs
题目描述:119. Magic Pairstime limit per test: 0.5 sec. memory limit per test: 4096 KB“Prove that for any integer X and Y if 5X+4Y is divided by 23 than 3X+7Y is divided by23 too.原创 2012-10-30 13:31:12 · 543 阅读 · 0 评论 -
sgu 117 Counting
题目描述:117. Countingtime limit per test: 0.5 sec. memory limit per test: 4096 KBFind amount of numbers for given sequence of integer numbers such that after raising them to theM-th pow原创 2012-10-29 08:54:15 · 416 阅读 · 0 评论 -
sgu 118 Digital Root
118. Digital Roottime limit per test: 0.5 sec. memory limit per test: 4096 KBLet f(n) be a sum of digits for positive integern. If f(n) is one-digit number then it is a digital root for n原创 2012-10-29 09:26:13 · 337 阅读 · 0 评论 -
sgu 130 Circle
题目描述:130. Circletime limit per test: 0.5 sec. memory limit per test: 4096 KBOn a circle border there are 2k different points A1, A2, ..., A2k, located contiguously. These points connec原创 2012-11-01 14:58:04 · 472 阅读 · 0 评论 -
sgu 107 987654321 problem
题目描述:107. 987654321 problemtime limit per test: 0.5 sec. memory limit per test: 4096 KBFor given number N you must output amount of N-digit numbers, such, that last digits of their squ原创 2012-10-24 17:35:44 · 397 阅读 · 0 评论 -
sgu 153 Playing with matches
153. Playing with matchestime limit per test: 0.5 sec.memory limit per test: 4096 KBinput: standard inputoutput: standard outputLittle boy Petya plays a game with his friend. They原创 2012-11-04 23:05:10 · 386 阅读 · 0 评论 -
sgu 151 Construct a triangle
题目描述:151. Construct a triangletime limit per test: 0.5 sec.memory limit per test: 4096 KBinput: standard inputoutput: standard outputFind coordinates of any triangle ABC if i原创 2012-11-04 16:45:21 · 410 阅读 · 0 评论 -
sgu 144
题目描述:144. Meetingtime limit per test: 0.5 sec. memory limit per test: 4096 KBTwo of the three membersof the winning team of one of the ACM regional contests are going to meetin order t原创 2012-11-04 11:06:48 · 334 阅读 · 0 评论 -
sgu 139 Help Needed!
题目描述:139. Help Needed!time limit per test: 0.5 sec. memory limit per test: 4096 KBLittle Johnny likespuzzles a lot! Just a few days ago, he found out about the 'traditional'4x4puzzle.原创 2012-11-02 20:48:21 · 614 阅读 · 0 评论 -
sgu 136 Erasing Edges
题目描述:136. Erasing Edgestime limit per test: 0.5 sec. memory limit per test: 4096 KBLittle Johnny paintedon a sheet of paper a polygon with N vertices. Then, for every edgeof the polygo原创 2012-11-02 18:20:08 · 494 阅读 · 0 评论 -
sgu 140 Integer Sequences
140. Integer Sequencestime limit per test: 0.5 sec. memory limit per test: 4096 KBA sequence Ais called aninteger sequence of length N if all its elementsA1A2 .. AN are non-negative integers原创 2012-11-03 09:52:32 · 664 阅读 · 0 评论 -
sgu 137 Funny Strings
题目描述:137. Funny Stringstime limit per test: 0.5 sec. memory limit per test: 4096 KBLet's consider a stringof non-negative integers, containingN elements. Suppose these elementsare S1原创 2012-11-02 19:39:19 · 400 阅读 · 0 评论 -
sgu 106 The equation
题目描述:106. The equationtime limit per test: 0.5 sec. memory limit per test: 4096 KBThere is an equation ax + by + c = 0. Given a,b,c,x1,x2,y1,y2 you must determine, how many integer roo原创 2012-10-24 00:48:13 · 611 阅读 · 0 评论