結果

問題 No.89 どんどんドーナツどーんといこう!
ユーザー @abcde@abcde
提出日時 2019-02-16 11:09:37
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 804 bytes
コンパイル時間 1,402 ms
コンパイル使用メモリ 157,948 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-15 19:52:49
合計ジャッジ時間 1,565 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    
    // 1. 入力情報取得.
    double c, rIn, rOut;
    cin >> c >> rIn >> rOut;
    
    // 2. ドーナツ の 体積 を 計算.
    double ans = 0.0;
    // ヒントにある "パップス・ギュルダンの定理(第二定理)" を使う.
    // V = 2πRS
    // -> ここでは, R = (rIn + rOut) ÷ 2.0, S = π × {(rOut - rIn) ÷ 2} × {(rOut - rIn) ÷ 2}
    // を適用することになる.
    double R = (rIn + rOut) / 2.0;
    double r = (rOut - rIn) / 2.0;
    
    // 2-1. ドーナツの体積計算.
    ans = 2.0 * M_PI * R * (M_PI * r * r);
    // 2-2. ドーナツのカロリーを計算.
    ans *= c;
    
    // 3. 出力.
    cout << fixed;
    cout << setprecision(10) << ans << endl;
    return 0;
    
}
0