随笔分类 - ACM---扩展欧几里得
摘要:One Person GameTime Limit:2 Seconds Memory Limit:65536 KBThere is an interesting and simple one person game. Suppose there is a number axis under your...
阅读全文
摘要:C LooooopsTime Limit:1000MSMemory Limit:65536KTotal Submissions:15066Accepted:3820DescriptionA Compiler Mystery: We are given a C-language style for loop of typefor (variable = A; variable != B; variable += C) statement;I.e., a loop which starts by setting variable to value A and while variable is .
阅读全文
摘要:X问题Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2522Accepted Submission(s): 790Problem Description求在小于等于N的正整数中有多少个X满足:X mod a[0] = b[0], X mod a[1] = b[1], X mod a[2] = b[2], …, X mod a[i] = b[i], … (0 2 #include 3 #include 4 #include 5 usi...
阅读全文
摘要:BiorhythmsTime Limit:1000MSMemory Limit:10000KTotal Submissions:103539Accepted:32012DescriptionSome people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have periods o
阅读全文
摘要:Strange Way to Express IntegersTime Limit:1000MSMemory Limit:131072KTotal Submissions:8193Accepted:2448DescriptionElina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The way is described as following:Choosekdifferent positive integersa1,a2,…
阅读全文
摘要:Hello KikiTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1678 Accepted Submission(s): 587 Problem DescriptionOne day I was shopping in the supermarket. There was a cashier counting coins seriously when a little kid running and singing "门前大桥
阅读全文
摘要:Chinese remainder theorem againTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1299Accepted Submission(s): 481Problem Description我知道部分同学最近在看中国剩余定理,就这个定理本身,还是比较简单的:假设m1,m2,…,mk两两互素,则下面同余方程组:x≡a1(mod m1)x≡a2(mod m2)…x≡ak(mod mk)在011 #include12 #inclu
阅读全文
摘要:中国剩余定理,孙子高富帅。中国剩余定理到求解运用到了扩展欧几里得算法。求解模线性方程组(中国余数定理) a=B[1](mod W[1]) a=B[2](mod W[2]) ........ a=B[n](mod W[n]) 其中W,B已知,W[i]>0且W[i]与W[j]互质, 求a 设m1,m2,…mk是两两互素的正数,则对任意的整数b1,b2,…bk,同余方程组 x1 = b1 mod m1x2 = b2 mod m2 … xk = bk mod mk 其解为: X = (M1’*M1*b1)+(M2’*M2*b2)+…+(Mk’*Mk*bk) mod m; 其中 m = ...
阅读全文
摘要:A/BTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1147Accepted Submission(s): 887Problem Description要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。每组数据有两个数n(0 10 a=b;11 b=9973;12 c=n;13 14 */15 16 17 18
阅读全文
摘要:青蛙的约会Time Limit:1000MSMemory Limit:10000KTotal Submissions:81606Accepted:14116Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西...
阅读全文
摘要:RomanticTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2385Accepted Submission(s): 944Problem DescriptionThe Sky is Sprite.The Birds is Fly in the Sky.The Wind is Wonderful.Blew Throw the TreesTrees are Shaking, Leaves are Falling.Lovers Walk pass
阅读全文
浙公网安备 33010602011771号