Artifact 395c6eb44878070252ff0bb48d24b9f642b08ad4
- File
lib/geo/pythagoras.cpp
- 2013-12-05 00:29:40 - part of checkin [4c3be66099] on branch trunk - Comment (user: kinaba) [annotate]
//------------------------------------------------------------- // Enumerate coprime pythagoras triangles // // Verified by // - SRM 599 Div1 LV2 //------------------------------------------------------------- for(int m=1;; ++m) for(int n=1; n<m; ++n) if(((m^n)&1) && gcd(m,n)==1) { int a = m*m-n*n, b = 2*m*n, c = m*m+n*n; if(a>b) swap(a,b); }