結果

問題 No.1319 最強とんがりコーン
ユーザー tnakao0123tnakao0123
提出日時 2020-12-19 02:57:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 1,093 bytes
コンパイル時間 841 ms
コンパイル使用メモリ 94,576 KB
実行使用メモリ 43,072 KB
最終ジャッジ日時 2023-10-21 08:54:04
合計ジャッジ時間 18,374 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 213 ms
43,072 KB
testcase_01 AC 213 ms
43,072 KB
testcase_02 AC 217 ms
43,072 KB
testcase_03 AC 198 ms
43,072 KB
testcase_04 AC 214 ms
43,072 KB
testcase_05 AC 233 ms
43,072 KB
testcase_06 AC 222 ms
43,072 KB
testcase_07 AC 198 ms
43,072 KB
testcase_08 AC 222 ms
43,072 KB
testcase_09 AC 231 ms
43,072 KB
testcase_10 AC 225 ms
43,072 KB
testcase_11 AC 193 ms
43,072 KB
testcase_12 AC 221 ms
43,072 KB
testcase_13 AC 202 ms
43,072 KB
testcase_14 AC 210 ms
43,072 KB
testcase_15 AC 206 ms
43,072 KB
testcase_16 AC 205 ms
43,072 KB
testcase_17 AC 225 ms
43,072 KB
testcase_18 AC 199 ms
43,072 KB
testcase_19 AC 218 ms
43,072 KB
testcase_20 AC 209 ms
43,072 KB
testcase_21 AC 206 ms
43,072 KB
testcase_22 AC 207 ms
43,072 KB
testcase_23 AC 206 ms
43,072 KB
testcase_24 AC 207 ms
43,072 KB
testcase_25 AC 212 ms
43,072 KB
testcase_26 AC 205 ms
43,072 KB
testcase_27 AC 205 ms
43,072 KB
testcase_28 AC 202 ms
43,072 KB
testcase_29 AC 208 ms
43,072 KB
testcase_30 AC 202 ms
43,072 KB
testcase_31 AC 210 ms
43,072 KB
testcase_32 AC 220 ms
43,072 KB
testcase_33 AC 216 ms
43,072 KB
testcase_34 AC 203 ms
43,072 KB
testcase_35 AC 199 ms
43,072 KB
testcase_36 AC 196 ms
43,072 KB
testcase_37 AC 198 ms
43,072 KB
testcase_38 AC 200 ms
43,072 KB
testcase_39 AC 208 ms
43,072 KB
testcase_40 AC 179 ms
43,072 KB
testcase_41 AC 208 ms
43,072 KB
testcase_42 AC 194 ms
43,072 KB
testcase_43 AC 214 ms
43,072 KB
testcase_44 AC 192 ms
43,072 KB
testcase_45 AC 219 ms
43,072 KB
testcase_46 AC 213 ms
43,072 KB
testcase_47 AC 205 ms
43,072 KB
testcase_48 AC 192 ms
43,072 KB
testcase_49 AC 199 ms
43,072 KB
testcase_50 AC 204 ms
43,072 KB
testcase_51 AC 212 ms
43,072 KB
testcase_52 AC 212 ms
43,072 KB
testcase_53 AC 218 ms
43,072 KB
testcase_54 AC 192 ms
43,072 KB
testcase_55 AC 201 ms
43,072 KB
testcase_56 AC 218 ms
43,072 KB
testcase_57 AC 228 ms
43,072 KB
testcase_58 AC 221 ms
43,072 KB
testcase_59 AC 223 ms
43,072 KB
testcase_60 AC 92 ms
43,008 KB
testcase_61 AC 92 ms
43,008 KB
testcase_62 AC 92 ms
43,008 KB
testcase_63 AC 181 ms
43,072 KB
testcase_64 AC 212 ms
43,072 KB
testcase_65 AC 209 ms
43,072 KB
testcase_66 AC 93 ms
43,008 KB
testcase_67 AC 205 ms
43,072 KB
testcase_68 AC 224 ms
43,072 KB
testcase_69 AC 196 ms
43,072 KB
testcase_70 AC 203 ms
43,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1319.cc:  No.1319 最強とんがりコーン - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 5000000;
const double PI = acos(-1.0);

/* typedef */

/* global variables */

double ars[N + 1];

/* subroutines */

/* main */

int main() {
  double r, h, d;
  scanf("%lf%lf%lf", &r, &h, &d);

  double r0 = d * 0.5;
  double h0 = h * (1.0 - r0 / r), dh = h0 / N;

  for (int i = 0; i < N; i++) {
    double rz = r * (h - dh * i) / h;
    double th = acos(r0 / rz);
    ars[i] = rz * rz * th - r0 * r0 * tan(th);
    //printf("rz=%lf, th=%lf, ars[%d]=%lf\n", rz, th, i, ars[i]);
  }
  ars[N] = 0.0;
  
  double v = 0.0;
  for (int i = 0; i < N; i++)
    v += (ars[i] + ars[i + 1]) / 2 * dh;

  printf("%.15lf\n", v * 2);
  return 0;
}
0