結果

問題 No.869 ふたつの距離
コンテスト
ユーザー tiger2005
提出日時 2026-05-28 12:11:24
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 956 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,317 ms
コンパイル使用メモリ 330,032 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-28 12:11:51
合計ジャッジ時間 18,649 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 93
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int f(int x) {
  return x * (x - 1) / 2;
}

const double MAX = 1e5;
const double PI = acos(-1.0);
const double THETA = 1e-4;
const double EPSILON = 1e-6;

int n, a, b;

double angle[1510];

int main() {
  scanf("%d%d%d", &n, &a, &b);
  int p = 1;
  while (f(p) < b)
    ++ p;

  int k = b - f(p - 1);
  double R = PI / 3;
  double A = 2 * asin(0.25);

  int X = (p - 1) / 2, Y = p - 1 - X;
  int ra = a - f(X) - f(Y);

  for (int i = 1; i < p; i ++) {
    if (i <= X) {
      angle[i] = i * THETA;
    } else {
      int d = min(ra, X);
      ra -= d;
      angle[i] = A + (2 * X - d + 0.5) * THETA;
    }
  }

  printf("0 0\n");
  for (int i = 1; i < p; i ++) {
    double radius = (i <= k) ? 20 - EPSILON : 20 + EPSILON;
    printf("%.12lf %.12lf\n", radius * cos(angle[i]), radius * sin(angle[i]));
  }

  for (int i = p + 1; i <= n; i ++) {
    printf("%.12lf %.12lf\n", 1e4, i * 21.0);
  }
  return 0;
}
0