結果
| 問題 |
No.1447 Greedy MtSaka
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-31 16:03:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 513 bytes |
| コンパイル時間 | 1,276 ms |
| コンパイル使用メモリ | 83,856 KB |
| 最終ジャッジ日時 | 2025-01-20 02:02:06 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#line 1 "main.cpp"
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
void solve() {
int n;
cin >> n;
vector<pair<int, int>> ps(n);
for (auto& [x, y] : ps) cin >> x >> y;
int ans = 0;
for (int i = 0; i < n; ++i) {
auto [x1, y1] = ps[i];
auto [x2, y2] = ps[(i + 1) % n];
ans += x1 * y2 - x2 * y1;
}
cout << abs(ans) << "\n";
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
solve();
return 0;
}