亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? zz.txt

?? 大數運算類
?? TXT
?? 第 1 頁 / 共 2 頁
字號:

/**************************************************************************\

MODULE: ZZ

SUMMARY:

The class ZZ is used to represent signed, arbitrary length integers.

Routines are provided for all of the basic arithmetic operations, as
well as for some more advanced operations such as primality testing.
Space is automatically managed by the constructors and destructors.

This module also provides routines for generating small primes, and
fast routines for performing modular arithmetic on single-precision
numbers.


\**************************************************************************/

#include <NTL/tools.h>


class ZZ {
public:

   ZZ(); // initial value is 0

   ZZ& operator=(const ZZ& a);  // assignment operator
   ZZ& operator=(long a);  

   ZZ(const ZZ& a);  // copy constructor
   ~ZZ(); // destructor


   // ...

};


// NOTE: A ZZ is represented as a sequence of "zzigits",
// where each zzigit is between 0 and 2^{NTL_ZZ_NBITS-1}.

// NTL_ZZ_NBITS is  macros defined in <NTL/ZZ.h>.

// SIZE INVARIANT: the number of bits in a ZZ is always less than
// 2^(NTL_BITS_PER_LONG-4).



/**************************************************************************\

                                 Comparison

\**************************************************************************/



// The usual comparison operators: 
   
long operator==(const ZZ& a, const ZZ& b);
long operator!=(const ZZ& a, const ZZ& b);
long operator<(const ZZ& a, const ZZ& b);
long operator>(const ZZ& a, const ZZ& b);
long operator<=(const ZZ& a, const ZZ& b);
long operator>=(const ZZ& a, const ZZ& b);

// other stuff:

long sign(const ZZ& a); // returns sign of a (-1, 0, +1)
long IsZero(const ZZ& a); // test for 0
long IsOne(const ZZ& a); // test for 1

long compare(const ZZ& a, const ZZ& b); // returns sign of a-b (-1, 0, or 1).

// PROMOTIONS: the comparison operators and the function compare
// support promotion from long to ZZ on (a, b).


/**************************************************************************\

                                 Addition

\**************************************************************************/


// operator notation:

ZZ operator+(const ZZ& a, const ZZ& b);
ZZ operator-(const ZZ& a, const ZZ& b);
ZZ operator-(const ZZ& a); // unary -

ZZ& operator+=(ZZ& x, const ZZ& a); 
ZZ& operator+=(ZZ& x, long a); 

ZZ& operator-=(ZZ& x, const ZZ& a); 
ZZ& operator-=(ZZ& x, long a); 

ZZ& operator++(ZZ& x);  // prefix
void operator++(ZZ& x, int);  // postfix

ZZ& operator--(ZZ& x);  // prefix
void operator--(ZZ& x, int);  // postfix



// procedural versions:

void add(ZZ& x, const ZZ& a, const ZZ& b); // x = a + b
void sub(ZZ& x, const ZZ& a, const ZZ& b); // x = a - b
void SubPos(ZZ& x, const ZZ& a, const ZZ& b); // x = a-b; assumes a >= b >= 0.
void negate(ZZ& x, const ZZ& a); // x = -a

void abs(ZZ& x, const ZZ& a); // x = |a|
ZZ abs(const ZZ& a);

// PROMOTIONS: binary +, -, as well as the procedural versions add, sub
// support promotions from long to ZZ on (a, b).


/**************************************************************************\

                             Multiplication

\**************************************************************************/

// operator notation:

ZZ operator*(const ZZ& a, const ZZ& b);

ZZ& operator*=(ZZ& x, const ZZ& a);
ZZ& operator*=(ZZ& x, long a);

// procedural versions:

void mul(ZZ& x, const ZZ& a, const ZZ& b); // x = a * b

void sqr(ZZ& x, const ZZ& a); // x = a*a
ZZ sqr(const ZZ& a); 

// PROMOTIONS: operator * and procedure mul support promotion
// from long to ZZ on (a, b).


/**************************************************************************\

                                 Division

\**************************************************************************/


// operator notation:

ZZ operator/(const ZZ& a, const ZZ& b);
ZZ operator/(const ZZ& a, long  b);

ZZ operator%(const ZZ& a, const ZZ& b);
long operator%(const ZZ& a, long b);

ZZ& operator/=(ZZ& x, const ZZ& b);
ZZ& operator/=(ZZ& x, long b);

ZZ& operator%=(ZZ& x, const ZZ& b);


// procedural versions:

void DivRem(ZZ& q, ZZ& r, const ZZ& a, const ZZ& b);
// q = floor(a/b), r = a - b*q.
// This implies that:
//    |r| < |b|, and if r != 0, sign(r) = sign(b)

void div(ZZ& q, const ZZ& a, const ZZ& b);
// q = floor(a/b)

void rem(ZZ& r, const ZZ& a, const ZZ& b);
// q = floor(a/b), r = a - b*q


// single-precision variants:

long DivRem(ZZ& q, const ZZ& a, long b);
// q = floor(a/b), r = a - b*q, return value is r.

long rem(const ZZ& a, long b);
// q = floor(a/b), r = a - b*q, return value is r.


// divisibility testing:

long divide(ZZ& q, const ZZ& a, const ZZ& b);
long divide(ZZ& q, const ZZ& a, long b);
// if b | a, sets q = a/b and returns 1; otherwise returns 0.

long divide(const ZZ& a, const ZZ& b);
long divide(const ZZ& a, long b);
// if b | a, returns 1; otherwise returns 0.


/**************************************************************************\

                                    GCD's

\**************************************************************************/


void GCD(ZZ& d, const ZZ& a, const ZZ& b);
ZZ GCD(const ZZ& a, const ZZ& b); 

// d = gcd(a, b) (which is always non-negative).  Uses a binary GCD
// algorithm.



void XGCD(ZZ& d, ZZ& s, ZZ& t, const ZZ& a, const ZZ& b);

//  d = gcd(a, b) = a*s + b*t.

// The coefficients s and t are defined according to the standard
// Euclidean algorithm applied to |a| and |b|, with the signs then
// adjusted according to the signs of a and b.

// Uses a variant of Lehmer's algorithm (see Knuth, The Art of Computer
// Programming, vol. 2).




// special-purpose single-precision variants:

long GCD(long a, long b);
// return value is gcd(a, b) (which is always non-negative)

void XGCD(long& d, long& s, long& t, long a, long b);
//  d = gcd(a, b) = a*s + b*t.

//  The coefficients s and t are defined according to the standard
//  Euclidean algorithm applied to |a| and |b|, with the signs then
//  adjusted according to the signs of a and b.



/**************************************************************************\

                             Modular Arithmetic

The following routines perform arithmetic mod n, where n > 1.

All arguments (other than exponents) are assumed to be in the range
0..n-1.  Some routines may check this and raise an error if this
does not hold.  Others may not, and the behaviour is unpredictable
in this case.

\**************************************************************************/



void AddMod(ZZ& x, const ZZ& a, const ZZ& b, const ZZ& n); // x = (a+b)%n
ZZ AddMod(const ZZ& a, const ZZ& b, const ZZ& n);

void SubMod(ZZ& x, const ZZ& a, const ZZ& b, const ZZ& n); // x = (a-b)%n
ZZ SubMod(const ZZ& a, const ZZ& b, const ZZ& n);

void NegateMod(ZZ& x, const ZZ& a, const ZZ& n); // x = -a % n
ZZ NegateMod(const ZZ& a, const ZZ& n);

void MulMod(ZZ& x, const ZZ& a, const ZZ& b, const ZZ& n); // x = (a*b)%n
ZZ MulMod(const ZZ& a, const ZZ& b, const ZZ& n);

void SqrMod(ZZ& x, const ZZ& a, const ZZ& n); // x = a^2 % n
ZZ SqrMod(const ZZ& a, const ZZ& n);

void InvMod(ZZ& x, const ZZ& a, const ZZ& n);
ZZ InvMod(const ZZ& a, const ZZ& n);
// x = a^{-1} mod n (0 <= x < n); error is raised occurs if inverse
// not defined

long InvModStatus(ZZ& x, const ZZ& a, const ZZ& n);
// if gcd(a,b) = 1, then return-value = 0, x = a^{-1} mod n;
// otherwise, return-value = 1, x = gcd(a, n)

void PowerMod(ZZ& x, const ZZ& a, const ZZ& e, const ZZ& n);
ZZ PowerMod(const ZZ& a, const ZZ& e, const ZZ& n);

void PowerMod(ZZ& x, const ZZ& a, long e, const ZZ& n);
ZZ PowerMod(const ZZ& a, long e, const ZZ& n);

// x = a^e % n (e may be negative)


// PROMOTIONS: AddMod, SubMod, and MulMod (both procedural and functional
// forms) support promotions from long to ZZ on (a, b).


/**************************************************************************\

                        Single-precision modular arithmetic

These routines implement single-precision modular arithmetic.  If n is
the modulus, all inputs should be in the range 0..n-1.  The number n
itself should be in the range 2..NTL_SP_BOUND-1.

Most of these routines are, of course, implemented as fast inline
functions.  No checking is done that inputs are in range.

\**************************************************************************/




long AddMod(long a, long b, long n); // return (a+b)%n

long SubMod(long a, long b, long n); // return (a-b)%n

long NegateMod(long a, long n); // return (-a)%n

long MulMod(long a, long b, long n); // return (a*b)%n

long MulMod(long a, long b, long n, double ninv);
// return (a*b)%n.  ninv = 1/((double) n).  This is faster if n is
// fixed for many multiplications.


long MulMod2(long a, long b, long n, double bninv);
// return (a*b)%n.  bninv = ((double) b)/((double) n).  This is faster
// if both n and b are fixed for many multiplications.


long MulDivRem(long& q, long a, long b, long n, double bninv);
// return (a*b)%n, set q = (a*b)/n.  bninv = ((double) b)/((double) n)

long InvMod(long a, long n);
// computes a^{-1} mod n.  Error is raised if undefined.

long PowerMod(long a, long e, long n);
// computes a^e mod n (e may be negative)

/**************************************************************************\

                               Shift Operations

LeftShift by n means multiplication by 2^n
RightShift by n means division by 2^n, with truncation toward zero
  (so the sign is preserved).

A negative shift amount reverses the direction of the shift.

\**************************************************************************/

// operator notation:

ZZ operator<<(const ZZ& a, long n);
ZZ operator>>(const ZZ& a, long n);

ZZ& operator<<=(ZZ& x, long n);
ZZ& operator>>=(ZZ& x, long n);

// procedural versions:

void LeftShift(ZZ& x, const ZZ& a, long n); 
ZZ LeftShift(const ZZ& a, long n);

void RightShift(ZZ& x, const ZZ& a, long n); 
ZZ RightShift(const ZZ& a, long n); 



/**************************************************************************\

                              Bits and Bytes

\**************************************************************************/



long MakeOdd(ZZ& x);
// removes factors of 2 from x, returns the number of 2's removed
// returns 0 if x == 0

long NumTwos(const ZZ& x);
// returns max e such that 2^e divides x if x != 0, and returns 0 if x == 0.

long IsOdd(const ZZ& a); // test if a is odd

long NumBits(const ZZ& a);
long NumBits(long a);  
// returns the number of bits in binary represenation of |a|; 
// NumBits(0) = 0


long bit(const ZZ& a, long k);
long bit(long a, long k); 
// returns bit k of |a|, position 0 being the low-order bit.
// If  k < 0 or k >= NumBits(a), returns 0.


void trunc(ZZ& x, const ZZ& a, long k);
// x = low order k bits of |a|. 
// If k <= 0, x = 0.

// two functional variants:
ZZ trunc_ZZ(const ZZ& a, long k);  
long trunc_long(const ZZ& a, long k);

long SetBit(ZZ& x, long p);
// returns original value of p-th bit of |a|, and replaces p-th bit of
// a by 1 if it was zero; low order bit is bit 0; error if p < 0;
// the sign of x is maintained

long SwitchBit(ZZ& x, long p);
// returns original value of p-th bit of |a|, and switches the value
// of p-th bit of a; low order bit is bit 0; error if p < 0
// the sign of x is maintained

long weight(const ZZ& a); // returns Hamming weight of |a|
long weight(long a); 

// bit-wise Boolean operations, procedural form:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩亚洲另类| 国产精品美女久久久久久久 | 男女男精品网站| 国产精品99久久久久久久女警 | 亚洲成人免费看| 国产激情一区二区三区四区 | 国产精品九色蝌蚪自拍| 日韩福利电影在线| 99久久99久久精品国产片果冻| 在线不卡a资源高清| 国产精品天天看| 黄色日韩三级电影| 欧亚洲嫩模精品一区三区| 久久精品视频在线看| 日韩国产精品大片| 欧美伊人久久久久久久久影院| 久久精品亚洲国产奇米99| 日本麻豆一区二区三区视频| 色综合天天狠狠| 国产精品伦理在线| 国产麻豆精品视频| 欧美精品一区视频| 三级亚洲高清视频| 欧美妇女性影城| 亚洲国产精品综合小说图片区| 99久久久精品| 国产精品国产三级国产有无不卡 | 国产精品18久久久久久久网站| 这里是久久伊人| 亚洲电影一区二区| 欧美日本在线播放| 亚洲成a人片综合在线| 欧美综合天天夜夜久久| 亚洲精品久久久久久国产精华液| 国产1区2区3区精品美女| 久久久久久久精| 国产福利精品导航| 国产亚洲女人久久久久毛片| 国产成人超碰人人澡人人澡| 久久精品亚洲一区二区三区浴池| 国产精品系列在线播放| 国产情人综合久久777777| 国产99久久精品| 中文字幕在线一区| 91免费精品国自产拍在线不卡| 玉米视频成人免费看| 欧美视频中文字幕| 日本aⅴ亚洲精品中文乱码| 日韩三级高清在线| 国产在线精品一区二区| 久久精品亚洲麻豆av一区二区| 成人av资源在线观看| 亚洲精品乱码久久久久久| 欧美日韩精品一区二区三区蜜桃| 午夜av电影一区| 精品乱码亚洲一区二区不卡| 国产99久久久国产精品| 一区二区免费在线播放| 7777精品伊人久久久大香线蕉经典版下载 | 免费黄网站欧美| 欧美精品一区二| av在线不卡电影| 香蕉成人啪国产精品视频综合网| 欧美大片在线观看| 成人免费高清在线| 亚洲国产一二三| 日韩美女在线视频| 不卡视频免费播放| 亚洲18女电影在线观看| 久久综合狠狠综合久久综合88 | 国产精品一线二线三线精华| 亚洲色图都市小说| 日韩一区二区精品| 不卡欧美aaaaa| 青草国产精品久久久久久| 久久精品视频网| 欧美三级日韩三级| 国产精品资源在线观看| 亚洲一二三四区| 欧美本精品男人aⅴ天堂| www.66久久| 久久精品72免费观看| 亚洲老司机在线| 国产欧美综合色| 欧美另类变人与禽xxxxx| 成人性视频免费网站| 日韩精品视频网| 亚洲欧美电影一区二区| 精品福利在线导航| 欧美亚洲国产bt| 99久久99精品久久久久久| 国产一区二区三区四| 午夜视频一区在线观看| 国产精品家庭影院| 亚洲国产精品v| 欧美成人一级视频| 欧美精品九九99久久| 91丨九色丨蝌蚪富婆spa| 国产福利一区在线观看| 久久av资源网| 免费精品视频在线| 日日夜夜精品视频免费| 亚洲综合精品久久| 亚洲精品国久久99热| 亚洲欧洲国产专区| 国产精品萝li| 中文字幕av一区二区三区高| 久久亚洲二区三区| 精品美女一区二区| 2022国产精品视频| 久久久一区二区三区捆绑**| 欧美电影免费观看高清完整版在线观看| 欧美影院精品一区| 色婷婷综合久久| 色8久久人人97超碰香蕉987| 色香蕉成人二区免费| 91丝袜国产在线播放| 91麻豆123| 日本道免费精品一区二区三区| 99久久久国产精品免费蜜臀| 91一区一区三区| 91麻豆福利精品推荐| 在线区一区二视频| 欧美日韩三级视频| 欧美日韩二区三区| 日韩三级精品电影久久久 | 欧美喷水一区二区| 欧美一区二区三区视频| 日韩三级av在线播放| 精品日产卡一卡二卡麻豆| 久久精品免费在线观看| 国产农村妇女毛片精品久久麻豆 | 精品人在线二区三区| 久久精品欧美日韩| 最新日韩av在线| 亚洲一区二区在线观看视频 | 一区二区三区.www| 五月天国产精品| 国产在线日韩欧美| 成人性生交大片免费看视频在线| 成人18视频在线播放| 欧美综合一区二区| 日韩精品专区在线影院重磅| 国产欧美一区二区在线| 亚洲激情图片小说视频| 日本中文字幕一区二区有限公司| 国产又黄又大久久| 99精品国产99久久久久久白柏| 欧美色欧美亚洲另类二区| 日韩欧美国产一区在线观看| 欧美激情在线一区二区三区| 一区二区三区蜜桃网| 久久精品国产久精国产| 国产宾馆实践打屁股91| 在线这里只有精品| 精品国产一区二区三区久久久蜜月| 国产色爱av资源综合区| 亚洲图片欧美色图| 国产精品亚洲一区二区三区妖精| 色成人在线视频| 久久精品亚洲精品国产欧美| 亚洲成av人在线观看| 国产+成+人+亚洲欧洲自线| 欧美肥妇bbw| 国产精品亲子乱子伦xxxx裸| 日韩经典一区二区| 99久久婷婷国产综合精品电影 | 国产一区二区三区四区五区入口 | 久久久久国产精品麻豆ai换脸| 亚洲欧美日韩中文播放| 久久99精品国产.久久久久| 99久久精品国产毛片| 亚洲精品一区二区三区精华液 | 正在播放一区二区| 伊人夜夜躁av伊人久久| 国产美女一区二区三区| 9191精品国产综合久久久久久| 国产精品成人免费| 国产美女av一区二区三区| 欧美日韩日本视频| 亚洲欧美色图小说| 波多野洁衣一区| 国产三级精品视频| 精品中文字幕一区二区小辣椒| 欧美日韩国产一级片| 亚洲黄色av一区| 99久久精品国产毛片| 国产日韩亚洲欧美综合| 精品在线观看视频| 欧美顶级少妇做爰| 亚洲国产日产av| 色婷婷香蕉在线一区二区| 国产精品久久午夜| 懂色中文一区二区在线播放| 精品国产第一区二区三区观看体验| 夜夜操天天操亚洲| 91成人在线精品| 亚洲综合一二三区| 精品视频在线免费| 亚洲不卡av一区二区三区|