結果
問題 |
No.461 三角形はいくつ?
|
ユーザー |
![]() |
提出日時 | 2017-04-20 01:40:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 920 bytes |
コンパイル時間 | 1,476 ms |
コンパイル使用メモリ | 169,708 KB |
実行使用メモリ | 10,268 KB |
最終ジャッジ日時 | 2024-07-19 09:33:32 |
合計ジャッジ時間 | 8,232 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 1 TLE * 1 -- * 39 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) typedef long double ld; int N; vector<ld> vec[3]; ld EPS = 1e-18; //----------------------------------------------------------------------------------- int count() { int ans = 0; for(ld a : vec[0]) for(ld b : vec[1]) for(ld c : vec[2]) { ld sum = a + b + c; if (abs(1 - sum) < EPS) continue; ld ab = a + b; ld bc = b + c; ld ac = a + c; if (1 < ab) continue; if (1 < bc) continue; if (1 < ac) continue; ans++; } return ans; } //----------------------------------------------------------------------------------- int main() { cin >> N; rep(i, 0, 3) vec[i].push_back(0); rep(i, 0, N) { int P, A, B; scanf("%d%d%d", &P, &A, &B); vec[P].push_back((ld)B / (ld)(A + B)); } cout << count() << endl; }