# 11208: 【原1208】大圣切蛋糕

### 题目描述

author: Fangkui Zhang 原OJ链接：https://acm.sjtu.edu.cn/OnlineJudge-old/problem/1208 ﻿## Description

## Sample Input 1

``````10 5
``````

## Sample Output 1

``````61.42
``````

## Sample Input 2

``````10 5
20 8
``````

## Sample Output 2

``````317.07
``````

## FineArtz's solution

``````/* 大圣切蛋糕 */
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

const double pi = 3.1415926;

int main(){
double r, a, ans = 0.0;
while (cin >> r >> a){
double tans = acos(a/r) * r * r;
tans -= a * sqrt(r * r - a * a);
if (ans < tans) ans = tans;
}
cout << setiosflags(ios::fixed) << setprecision(2) << ans << endl;
return 0;
}
``````

## ligongzzz's solution

``````#include "iostream"
#include "cstring"
#include "cstdio"
#include "cmath"
using namespace std;

int main() {
double r, d;
double ans = 0.0;
while (cin >> r >> d) {
double cur_ans = r * r * acos(d / r) - d * sqrt(r * r - d * d);
ans = cur_ans > ans ? cur_ans : ans;
}

printf("%.2f", ans);

return 0;
}
``````