結果
| 問題 |
No.2790 Athena 3
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2024-06-24 18:06:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 909 bytes |
| コンパイル時間 | 335 ms |
| コンパイル使用メモリ | 40,832 KB |
| 最終ジャッジ日時 | 2025-02-22 00:19:21 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:31:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
31 | for (int i = 0; i < K; i++) scanf("%d%d", xs + i, ys + i);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 2790.cc: No.2790 Athena 3 - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const int K = 3;
const int dxs[] = { 1, 0, -1, 0 }, dys[] = { 0, -1, 0, 1 };
/* typedef */
/* global variables */
int xs[K], ys[K];
/* subroutines */
inline int area(int vx0, int vy0, int vx1, int vy1) {
return abs(vx0 * vy1 - vx1 * vy0);
}
/* main */
int main() {
for (int i = 0; i < K; i++) scanf("%d%d", xs + i, ys + i);
int maxa = 0, kbits = 1 << (K * 2);
for (int bits = 0; bits < kbits; bits++) {
int dis[K], cxs[K], cys[K];
for (int i = 0; i < K; i++) {
int di = (bits >> (i * 2)) & 3;
cxs[i] = xs[i] + dxs[di], cys[i] = ys[i] + dys[di];
}
int a = area(cxs[1] - cxs[0], cys[1] - cys[0],
cxs[2] - cxs[0], cys[2] - cys[0]);
maxa = max(maxa, a);
}
printf("%.1lf\n", 0.5 * maxa);
return 0;
}
tnakao0123