1#include <cstdio>2#include <cstring>3#include <algorithm>4#include <cmath>5#include <vector>6#include <iostream>7#include <cassert>8 9 using namespacestd;Ten OnetypedefLong LongLLD; A - Const DoubleEPS = 1e-9; - Const intMOD =998244353; the - intSignDoublex) {returnx <-eps? -1: x >EPS;} - - structPoint { + LLD x, y; - Point () {} +Point (ConstLLD &x,ConstLLD &y): x (x), Y (y) {} A at void inch() { -CIN >> x >>y; - } - - BOOLDim ()Const { - returnX <0|| x = =0&& y <0; in } - }; to +Pointoperator+ (ConstPoint &a,ConstPoint &b) { - returnPoint (a.x + b.x, A.Y +b.y); the } *Pointoperator- (ConstPoint &a,ConstPoint &b) { $ returnPoint (a.x-b.x, A.Y-b.y);Panax Notoginseng } -Lldoperator* (ConstPoint &a,ConstPoint &b) { the returna.x * B.Y-A.Y *b.x; + } A BOOL operator< (ConstPoint &a,ConstPoint &b) { the if(A.dim () = =B.dim ()) { + returnA * b >0; -}Else { $ returnA.dim () >B.dim (); $ } - } - thetypedef vector<point>Points; - Wuyi LLD Pow_mod (LLD x, LLD N) { theLLD ret =1; - while(n) { Wu if(N &1) ret = ret * x%MOD; -N >>=1; x = x * x%MOD; About } $ returnret; - } - -InlinevoidAddint&x,intAD) { AX + =AD; + if(x >= MOD) x-=MOD; the } - $LLD Area (ConstPoint &a,ConstPoint &b) { the returnAb; the } the the intn, tot; -LLD pw2[1005]; inPoint vec[1005]; the the voidWork () { Aboutscanf"%d", &n); the Points Points (n); the for(inti =0; I < n; i++) { thePoints[i].inch(); + } - intAns =0; the for(inti =0; I < n; i++) {Bayitot =0; the for(intj =0; J < N; J + +) { the if(j = = i)Continue; -Vec[tot + +] = Points[j]-Points[i]; - } theSort (VEC, VEC +tot); the for(intj =0; J < tot; J + +) { the intL =1, r = Tot-1; the while(R >=l) { - intMid = (R + L) >>1; the intMid = (mid + j)%tot; the if(Vec[j] * Vec[mid] >0) { theL = mid +1;94}Else { theR = Mid-1; the } the }98--l; AboutAdd (ans, (area (Points[i], points[i] + vec[j])% MOD * (Pw2[l]-1)% mod + MoD)%MOD); - }101 }102printf"%d\n", ans);103 }104 the intMain () {106pw2[0] =1;107 for(inti =1; I <= +; i++) {108Pw2[i] =2* pw2[i-1] %MOD;109 } the intT;111scanf"%d", &T); the for(intCAS =1; CAS <= T; cas++) {113 Work (); the } the return 0; the}View Code
Geometry calculation Template