牛客-C881 F - Random Point in Triangle
Code
1/**
2 * author: Akvicor
3 * created: 2019-07-21 09-33-42
4**/
5
6#include <bits/stdc++.h>
7
8using namespace std;
9
10#ifdef DEBUG
11#define FAST_IO 17
12#else
13#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
14#define endl '\n'
15#endif
16
17#define rep(i, n) for(int i = 0; i < (n); ++i)
18#define reep(i, n) for(int i = 0; i <= (n); ++i)
19#define lop(i, a, n) for(int i = a; i < (n); ++i)
20#define loop(i, a, n) for(int i = a; i <= (n); ++i)
21#define prec(x) fixed << setprecision(x)
22#define ms(s, n) memset(s, n, sizeof(s))
23#define all(v) (v).begin(), (v).end()
24#define sz(x) ((int)(x).size())
25#define pb push_back
26#define mp make_pair
27#define fi first
28#define se second
29#define MOD(x) const int MOD = (int)x + 7
30#define MAXN(x) const int MAXN = (int)x + 7
31
32typedef long long LL;
33typedef unsigned long long ULL;
34typedef pair<int, int> PII;
35typedef vector<int> VI;
36typedef vector<PII> VII;
37
38namespace SOL{
39
40const double EPS = 1e-6;
41const double PI = acos(-1.0);
42const int INF = 0x3f3f3f3f;
43const LL LINF = 0x7f7f7f7f7f7f7f7f;
44
45/** >------- Akvicor's Solution -------< **/
46
47MOD(1e9);
48MAXN(1e6);
49
50LL x1, y1, x2, y2, x3, y3;
51
52void solve(){
53 FAST_IO;
54
55 while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3){
56 cout << 11ll * labs( (x3-x1) * (y2-y1) - (x2-x1)*(y3-y1) ) << endl;
57 }
58
59}
60
61/** >----------------------------------< **/
62
63}
64
65int main(){
66
67#ifdef DEBUG
68 int DEBUGCNT = 0;
69 clock_t DEBUGstart, DEBUGfinish;
70 double DEBUGduration;
71 cout << ">------- Akvicor's Solution -------<" << endl;
72DEBUGLOOP:
73 DEBUGstart = clock();
74#endif
75
76 SOL::solve();
77
78#ifdef DEBUG
79 DEBUGfinish = clock();
80 DEBUGduration = (double)(DEBUGfinish - DEBUGstart)*1000 / CLOCKS_PER_SEC;
81 cout << " --> Test: #" << DEBUGCNT << " time: " << fixed << setprecision(4) << DEBUGduration << " ms <--" << endl;
82 ++DEBUGCNT;
83 if(DEBUGCNT < 100) goto DEBUGLOOP;
84 cout << ">----------------------------------<" << endl;
85#endif
86
87 return 0;
88}
除另有声明外,本博客文章均采用 知识共享 (Creative Commons) 署名 4.0 国际许可协议 进行许可。转载请注明原作者与文章出处。