扩展欧几里德第二题~
这个题真是搞了好长时间才懂啊~~
题目大意:
有一个数mod ri 等于ai ,求这个数,若求不出来输出“-1”。
解题思路:
对于 x=r1(mod a1)
x=r2(mod a2)
相当于解不定方程:x*a1+y*a2=r2-r1
先求解方程:x*a1+y*a2=r2-r1=gcd(a1,a2)
得出解x,则方程x*...
分类:
其他好文 时间:
2014-08-08 21:27:16
阅读次数:
302
F - Strange Way to Express Integers
Time Limit:1000MS Memory Limit:131072KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
Elina is reading a book written by Rujia...
分类:
其他好文 时间:
2014-08-07 23:10:15
阅读次数:
402
favoriteI have nginx+php-fpm web serverSo I've noticed in php5-fpm.log many strange lines:[03-Sep-2013 09:25:23] NOTICE: [pool www] child 23999 exited...
分类:
Web程序 时间:
2014-08-06 22:53:12
阅读次数:
367
各类排序算法总结一. 排序的基本概念 排序(Sorting)是计算机程序设计中的一种重要操作,其功能是对一个数据元素集合或序列重新排列成一个按数据元素某个项值有序的序列。 有 n 个记录的序列{R1,R2,…,Rn},其相应关键字的序列是{K1,K2,…,Kn},相应的下标序列为1,2,…,n。通过排序,要求找出当前下标序列1,2,…, n 的一种排列p1,p2, …,pn,使得相应关键字满足如下...
分类:
其他好文 时间:
2014-08-05 19:33:00
阅读次数:
227
Absolute sortLet's try some sorting. Here is an array with the specific rules.The array (a tuple) has various numbers. You should sort it, but sort it...
分类:
其他好文 时间:
2014-08-05 10:50:49
阅读次数:
204
题目链接:http://acm.hdu.edu.cn/showproblem.pihp?pid=2899题目大意:找出满足F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 2 #include 3 #include 4 using namespace std; 5...
分类:
其他好文 时间:
2014-08-03 12:42:05
阅读次数:
172
Description
Gigel has a strange "balance" and he wants to poise it. Actually, the device is different from any other ordinary balance.
It orders two arms of negligible weight and each arm's lengt...
分类:
其他好文 时间:
2014-08-02 15:30:13
阅读次数:
235
#include#include#includeusing namespace std;struct node{ int a; char s[105]; }p[105];int cmp(node c,node b){ return c.a #include #inclu...
分类:
其他好文 时间:
2014-08-02 01:42:32
阅读次数:
246
错误#include#include#includeusing namespace std;struct node { int a; char s[1000]; }p[1000];int cmp(node c,node b){ return c.ap[k].s[j]) p[k].a++; ...
分类:
其他好文 时间:
2014-08-02 01:37:12
阅读次数:
212
B - Balance
Time Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
Gigel has a strange "balance" and he wants to poise it. Actually, t...
分类:
其他好文 时间:
2014-07-30 17:45:24
阅读次数:
271