text stringlengths 49 983k |
|---|
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
int n,a,b,c;
int d[100];
cin>>n>>a>>b>>c;
for(int i=0;i<n;i++)cin>>d[i];
sort(d,d+n,greater<int>());
int ans=c/a;
for(int i=0;i<n;i++){
c+=d[i];
a+=b;
ans=max(ans,c/a);
}
cout<<ans<<endl;
return 0;
} |
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
int main()
{
int n,a,b;
int c;
int d[100];
cin >> n >> a >> b >> c;
for(int i=0;i<n;i++)cin >> d[i];
sort(d,d+n);
int ans=c/a;
int co=c;
int price=a;
for(int i=n-1;i>=0;i--){
co+=d[i];
price+=b;
ans=max(ans,co/price);
//printf("%d\n",ans);
}
printf("%d\n",ans);
return 0;
} |
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
int len,n,i,j,x,a,b,c,kr[10001],max,cnt=1,p,su;
scanf("%d",&n);
scanf("%d %d",&a,&b);
scanf("%d",&c);
for(i=0;i<n;i++){
scanf("%d",&kr[i]);
}
sort(kr,kr+n,greater<int>());
max=c/a;
p=c;
for(i=0;i<n;i++){
p+=kr[i];
x=p/(a+b*(i+1));
if(max<x){
max=x;
}
}
printf("%d\n",max);
return 0;
} |
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <string>
#include <functional>
#include <math.h>
#include <utility>
using namespace std;
int n,A,B,Ac,Bc[100];
double t,last_t;
int main()
{
cin>>n>>A>>B>>Ac;
for(int i=0;i<n;i++){
cin>>Bc[i];
}
sort(Bc,Bc+n,greater<int>());
last_t=(double)Ac/A;
for(int i=0;i<n;i++){
Ac+=Bc[i];A+=B;
t=Ac/A;
if(t<last_t){
break;
}
last_t=t;
}
printf("%d\n",(int)last_t);
} |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N; cin >> N;
int A, B; cin >> A >> B;
int C; cin >> C;
vector<int> D(N);
for (int i = 0; i < N; ++i) {
cin >> D[i];
}
sort( D.begin(), D.end(), greater<int>() );
int price = A;
int del = C;
int ans = del / price;
for (int i = 0; i < D.size(); ++i) {
price += B;
del += D[i];
ans = max(ans, del / price);
}
cout << ans << endl;
} |
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
int main(){
int n, a, b, c, ans;
scanf("%d%d%d%d",&n,&a,&b,&c);
vector<int> v(n);
for(int i = 0; i < n; i++) scanf("%d", &v[i]);
sort(v.begin(),v.end(),greater<int>());
for(int i = 1; i < n; i++) v[i] += v[i-1];
ans = c/a;
for(int i = 0; i < n; i++) ans = max(ans,(c+v[i])/(a+b*(i+1)));
printf("%d\n", ans);
} |
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int p[101]={0},t[101];
int main(){
int n,a,b,i,j,c,l,g;
cin>>n>>a>>b>>c;
p[0]=c/a;
for(i=1;i<=n;i++)
{
cin>>t[i];
}
for(i=1;i<=n;i++){
for(j=i+1;j<=n;j++){
if(t[i]<t[j]){
g=t[i];
t[i]=t[j];
t[j]=g;
}
}
}
g=0;
for(i=1;i<=n;i++){
g+=t[i];
p[i]=max(p[i-1],(c+g)/(a+b*i));
}
cout<<p[n]<<endl;
return 0;
} |
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <functional>
using namespace std;
int main() {
vector<int> top;
int n, a, b, c;
cin >> n >> a >> b >> c;
int aa;
for (int i = 0; i < n; i++) {
cin >> aa;
top.emplace_back(aa);
}
std::sort(top.begin(), top.end(), std::greater<int>());
int mmax = 0, cal = 0;
for (int i = 0; i < n; i++) {
cal += top[i];
mmax = max(mmax, (c + cal) / (a + (i + 1)*b));
}
cout << mmax << endl;
} |
#include "bits/stdc++.h"
using namespace std;
//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
//Heron's formula
double area(double a, double b, double c) {
double s = (a + b + c) / 2;
return sqrt(s*(s - a)*(s - b)*(s - c));
}
signed main() {
cout << fixed << setprecision(8);
for (double a, l, x; cin >> a >> l >> x&&l;)
cout << area(a, l, l) + area(l, (l + x) / 2, (l + x) / 2) * 2 << endl;
return 0;
} |
#include <bits/stdc++.h> // only for GCC
using namespace std;
int main(){
double a, l, x;
while(cin >> a >> l >> x){
double b = sqrt(abs(pow(l, 2)-pow(a/2, 2)));
double ans = a*b/2;
double d = sqrt(pow((l+x)/2, 2)-pow(l/2, 2));
ans += l*d;
printf("%lf\n", ans);
}
} |
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
int a, l, x;
while (scanf("%d %d %d", &a, &l, &x) == 3){
double s1 = (a + 2 * l) / 2.0;
double s2 = (x + 2 * l) / 2.0;
double m = (l + x) / 2.0;
s1 = sqrt(s1 * (s1 - a) * (s1 - l) * (s1 - l));
s2 = 2 * sqrt(s2 * (s2 - m) * (s2 - m) * (s2 - l));
printf("%lf\n", s1 + s2);
}
return (0);
} |
#include<iostream>
#include<iomanip>
#include<complex>
using namespace std;
#define EPS 1e-10
double area2( double a, double b, double c){
double s = ( a + b + c ) / 2;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
int main(){
int a, l, x;
while(cin >> a >> l >> x){
double h = (l + x) / 2.0; // たぶん真ん中でしょ
cout << fixed << setprecision(6) << area2(a,l,l) + area2(h,h,l)*2 << endl;
}
} |
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
double area(double a, double l) {
return a * sqrt(l * l - a * a / 4.0) / 2.0;
}
int main() {
int a, l, x;
while (cin >> a >> l >> x) {
double ans = area(a, l) + 2 * area(l, (l + x) / 2.0);
printf("%.10f\n", ans);
}
} |
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
double calcs(double a, double b, double c){
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
cout.setf(ios::fixed);
cout.precision(8);
double a, l, x;
while(cin >> a >> l >> x){
cout << calcs(a, l, l) + calcs(l, (l+x)/2, (l+x)/2)*2 << endl;
}
return 0;
} |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
double calc(double a, double b){
return sqrt(a * a - b * b);
}
int main(){
double a, l, x, h, ans;
while(cin >> a >> l >> x){
h = calc(l, a / 2);
ans = a * h / 2;
h = calc((l + x) / 2, l / 2);
ans += l * h;
printf("%.10f\n", ans);
}
} |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
double heron( double a, double x, double l){
double s = (a+x+l)/2;
return sqrt(s*(s-a)*(s-x)*(s-l));//ヘロンの公式
}
int main(void){
double a,x,l;
while( cin >> a >> l >> x ){
double z = ( x + l ) / 2;
double S = heron(l,l,a) + 2 * heron(z,z,l);
printf("%.10f\n",S);
}
return 0;
} |
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
double heron(double a,double b,double c){
double s=(a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(void){
double a,l,x;
while(cin >> a >> l >> x){
double ans=0.0;
ans+=heron(l,l,a);
ans+=heron((l+x)/2,(l+x)/2,l)*2;
printf("%.10f",ans);
cout << endl;
}
return 0;
} |
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <functional>
#include <cassert>
typedef long long ll;
using namespace std;
#define debug(x) cerr << #x << " = " << (x) << endl;
#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010
typedef double P_type;
typedef complex<P_type> P;
const P_type P_eps = 1e-10; //??´??°???????????????
namespace std{
template<class T> bool operator<(const complex<T> &a, const complex<T> &b){
return a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real();
}
};
P rotate(P p, double theta){
return p * P(cos(theta), sin(theta));
}
//??????
double dot(P a, P b) {
return (a * conj(b)).real();
}
//??????
double cross(P a, P b) {
return (a * conj(b)).imag();
}
//???????¨???????
int ccw(P a, P b, P c){
if(cross(b-a,c-a) > P_eps) return 1; //COUNTER_CLOCKWISE
if(cross(b-a,c-a) < -P_eps) return -1; //CLOCKWISE
if(dot(b-a,c-a) < P_eps) return -2; //c -> a -> b
if(dot(a-b,c-b) < P_eps) return 2; //a -> b -> c
return 0; //a -> c -> b
}
/* ??????ab??¨???c????????¢ */
double distanceSP(P a, P b, P c) {
if ( dot(b-a, c-a) < P_eps ) return abs(c-a);
if ( dot(a-b, c-b) < P_eps ) return abs(c-b);
return abs(cross(b-a, c-a)) / abs(b-a);
}
/* ??´???ab??¨???c????????¢ */
double distanceLP(P a, P b, P c) {
return abs(cross(b-a, c-a)) / abs(b-a);
}
/* ????????????????????? */
double isContainedCP(P c, double r, P p){
return abs(c-p) < r - P_eps; //?????¨??????????????????
//return abs(c-p) < r + P_eps; //?????¨????????????
}
/* ??´??????????????? */
bool isIntersectedLL(P a1, P a2, P b1, P b2){
return abs(cross(a1-a2, b1-b2)) > P_eps;
}
/* ?????????????????? */
bool isIntersectedSS(P a1, P a2, P b1, P b2){
//??????a ??¨ ??´???b
P_type a = ccw(b1,b2,a1);
P_type b = ccw(b1,b2,a2);
//??????b ??¨ ??´???a
P_type c = ccw(a1,a2,b1);
P_type d = ccw(a1,a2,b2);
return a*b < P_eps && c*d < P_eps; // T?????????????????? -P_eps
}
/* ??????????????? */
bool isIntersectedCC(P c1, double r1, P c2, double r2){
double dist = abs(c1 - c2);
return abs(r1 - r2) < dist + P_eps && dist - P_eps < r1 + r2; //?????\?????\?????????
//return abs(r1 - r2) < dist - P_eps && dist + P_eps < r1 + r2; //?????\?????\?????????
}
/* ?????´??????????????? */
bool isIntersectedCL(P c, double r, P a1, P a2){
return distanceLP(a1, a2, c) < r + P_eps; //??\????????´????????????????????´??? - P_eps
}
/* ????????????????????? */
bool isIntersectedCS(P c, double r, P a1, P a2){
return isContainedCP(c,r,a1) &&
isContainedCP(c,r,a2) &&
distanceLP(a1, a2, c) < r + P_eps; //??\????????´????????????????????´??? - P_eps
}
/* ??´???/???????????? */
P getCrosspointLL(P a1, P a2, P b1, P b2) {
//assert(isIntersectedLL(a1, a2, b1, b2));
//assert(isIntersectedSS(a1, a2, b1, b2));
P a = a2 - a1;
P b = b2 - b1;
return a1 + a * cross(b, b1-a1) / cross(b, a);
}
P getCrosspointSS(P a1, P a2, P b1, P b2){
return getCrosspointLL(a1, a2, b1, b2);
}
/* ????????? */
pair<P,P> getCrosspointCC(P c1, double r1, P c2, double r2){
//assert(isIntersectedCC(c1, r1, c2, r2));
double dist = abs(c1 - c2);
double a = acos((r1*r1 + dist * dist - r2 * r2) / (2 * r1 * dist));
return {c1 + polar(r1, arg(c2 - c1) + a), c1 + polar(r1, arg(c2 - c1) - a)};
}
/* ??????????????? */
pair<P,P> getCrosspointCS(P c, double r, P a1, P a2){
//assert(isIntersectedCS(c1, r1, c2, r2));
P base1 = a2 - a1;
P proj = a1 + base1 * dot(c - a1, base1) / norm(base1); //?°???±
P e = (a2 - a1) / abs(a2 - a1);
P base2 = sqrt(r*r - norm(proj - c));
return {proj + e*base2, proj - e*base2};
}
/* ConvexHull(??????) */
vector<P> ConvexHull(vector<P> s){
vector<P> g;
int n = (int)s.size();
if(n<3) return s;
sort(s.begin(),s.end());
for(int i=0;i<n;i++){
for(int m = (int)g.size();m>=2 && ccw(g[m-2],g[m-1],s[i]) != -1; m--){
g.pop_back();
}
g.push_back(s[i]);
}
int t = (int)g.size();
for(int i=n-2;i>=0;i--){
for(int m = (int)g.size();m>t && ccw(g[m-2],g[m-1],s[i]) != -1; m--){
g.pop_back();
}
g.push_back(s[i]);
}
reverse(g.begin(),g.end());
g.pop_back();
return g;
}
bool solve(){
int a,l,x;
if(scanf("%d%d%d",&a,&l,&x) == EOF) return false;
P B(a,0),C(a/2.0, sqrt(l*l - (a/2.0)*(a/2.0)));
P D;
P Cp(-C.imag(),C.real());
Cp /= abs(Cp);
Cp *= sqrt(pow((l+x)/2.0,2) - pow(l/2.0,2));
D = C/2.0 + Cp;
printf("%.10lf\n",abs(cross(B,C))/2 + abs(cross(C,D)));
return true;
}
int main(){
while(solve());
return 0;
} |
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);
double helon(double a, double b, double c){
double ret = 0.0;
double s = (a+b+c)/2;
ret = sqrt(s*abs(a-s)*abs(b-s)*abs(c-s));
return ret;
}
int main(){
int a, l, x;
while(cin>>a>>l>>x){
double s = helon(a, l, l)+2*helon(l, (l+x)/2.0, (l+x)/2.0);//*max({helon(l, (l+x)/2.0, (l+x)/2.0), helon(x, l, l)});
printf("%.15lf\n", s);
}
} |
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;
#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }
typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
double S(double a, double b, double c){
double s = (a + b + c) / 2;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
int main(){
double a, l, x;
while(cin>>a>>l>>x){
double ans = S(a, l, l) + 2 * S(l, (l + x) / 2, (l + x) / 2);
printf("%.8f\n", ans);
}
return 0;
} |
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
double heron(double a, double b, double c){
double s = (a + b + c) / 2.0;
return sqrt(s * (s-a) * (s-b) * (s-c));
}
int main(){
double a,l,x;
while(cin >> a >> l >> x) printf("%.10f\n",heron(a,l,l) + heron(l,(l+x)/2.0,(l+x)/2.0)*2.0);
} |
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double Heron(double a, double b, double c){
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
double a, l, x;
while(cin >> a >> l >> x){
double ABC = Heron(a, l, l);
double ADC = Heron(l, (l+x)/2, (l+x)/2);
cout << fixed << setprecision(10) << ABC+ADC*2 << endl;
}
return 0;
} |
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
double a, l, x;
while(cin >> a >> l >> x){
double ret = 0;
double d = sqrt(abs(l*l-(a/2)*(a/2)));
ret += a*d/2;
double e = sqrt(pow((l+x)/2, 2)-pow((l/2), 2));
ret += e*l;
printf("%.9f\n", ret);
}
} |
#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
int main(void){
int a,l,x;
while(cin>>a>>l>>x){
double s1=(a+2.0*l)/2.0;
double S=sqrt(s1*(s1-a)*(s1-l)*(s1-l));
double s2=(2.0*l+x)/2.0;
S+=2.0*sqrt(s2*(s2-l)*(s2-(l+x)/2.0)*(s2-(l+x)/2.0));
printf("%.10f\n",S);
}
return 0;
} |
//#define LOCAL
#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main()
{
#ifdef LOCAL
ifstream in("input.txt");
cin.rdbuf(in.rdbuf());
#endif
int a, l, x;
while (cin >> a >> l >> x) {
double S = a * sqrt(l * l - a * a / 4.0) / 2.0;
double S2 = l * sqrt(((l + x) * (l + x) - l * l) / 4.0);
printf("%.10lf\n", S + S2);
}
} |
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (int)(a); v < (int)(b); ++v)
#define FORE(v, a, b) for(int v = (int)(a); v <= (int)(b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define RS resize
#define CLR clear
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
using namespace std;
void split(string str, char chr, vector< string > *res){
stringstream ss(str);
string itm;
while(getline(ss, itm, chr)){
(*res).PB(itm);
}
}
double Heron(double a, double b, double c){
double s = (a + b + c) / 2;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int a, l, x;
double area;
while(cin >> a >> l >> x){
area = Heron(a, l, l) + Heron(l, (double)(l + x) / 2, (double)(l + x) / 2) * 2;
cout << setprecision(15) << area << endl;
}
return 0;
} |
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
double helon(double a, double b, double c){
double s = (a + b + c) / 2;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
double a, l, x;
int main(){
while(~scanf("%lf%lf%lf", &a, &l, &x)){
printf("%.10lf\n", helon(a, l, l) + helon(l, (l+x)/2, (l+x)/2) * 2);
}
return 0;
} |
#include<iostream>
#include<cmath>
using namespace std;
int main(){
double a, l, x, t1, t2, s;
while(cin >> a >> l >> x){
x += l;
x /= 2;
t1 = acos((2*l*l - a*a)/(2*l*l));
t2 = acos((2*x*x - l*l)/(2*x*x));
s = l*l*sin(t1)/2 + x*x*sin(t2);
cout.setf(ios::fixed, ios::floatfield);
cout.precision(10);
cout << s << endl;
}
return 0;
} |
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
int main(void){
double a, l, x;
while (cin >> a){
cin >> l >> x;
double s = (2 * l + a)/2;
double A = sqrt(s*(s - a)*(s - l)*(s - l));
s = (2 * l + x) / 2;
double B = sqrt(s*(s - l)*(s - (l + x) / 2)*(s - (l + x) / 2));
printf("%.6f\n", A + 2*B);
}
return 0;
} |
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
int a,l,x;
while(cin>>a>>l>>x&&a){
double h=sqrt((l+x)*(l+x)-l*l)/2;
double g=sqrt(l*l-(double)a*a/4);
printf("%.8f\n",a*g/2+h*l);
}
return 0;
} |
#include<cmath>
#include<cstdio>
using namespace std;
double area(double a,double b,double c){
return sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c))/4;
}
int main(){
for(int a,l,x;~scanf("%d%d%d",&a,&l,&x);) printf("%.9f\n",area(a,l,l)+2*area(l,(l+x)/2.,(l+x)/2.));
return 0;
} |
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
fixed(cout);
cout << setprecision(13);
long a, l, x;
while (cin >> a >> l >> x) {
double h_1 = sqrt(l * l - a * a / 4.0);
double h_2 = sqrt((x + l) * (x + l) / 4.0 - l * l / 4.0);
cout << a * h_1 / 2 + l * h_2 << endl;
}
return 0;
} |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
double heron(double a,double b,double c){
double s = (a+b+c)/2;
return sqrt(s*(s - a)*(s - b)*(s - c));
}
int main(){
double a,l,x;
while( cin >> a >> l >> x ){
double m,s;
m = (x+l)/2;
s = 2*heron(m,m,l) + heron(a,l,l);
printf("%.7f\n",s);
}
} |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000 + 0;
//{{{ templates
#define TT_ template<typename T>inline
#define TTF_ template<typename T,typename F>inline
TT_ T sq(T x){return x*x;}
TT_ T In(){T x;cin>>x;return x;}
TT_ void Out(T&x){cout<<x;}
TT_ void sort(T&v){sort(begin(v),end(v));}
TT_ void revs(T&v){reverse(begin(v),end(v));}
TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT_ int ubnd(T&v,typename T::value_type&x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT_ int lbnd(T&v,typename T::value_type&x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
TT_ typename T::iterator minel(T&v){return min_element(begin(v),end(v));}
TT_ typename T::iterator maxel(T&v){return max_element(begin(v),end(v));}
inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}
//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple
ld area(ld a, ld b, ld c)
{
ld s = (a + b + c) / 2.0;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
int main()
{
int a, l, x;
while (~scanf("%d %d %d", &a, &l, &x)){
ld v = (l + x) / 2.0;
printf("%.10Lf\n", area(a, l, l) + 2 * area(l, v, v));
}
return 0;
} |
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
#define PI acos(-1)
using namespace std;
int main(){
int a,b,c;
while(cin>>a>>b>>c){
double sum=0;
sum+=a/2.0*sqrt(b*b-a*a/4.0);
sum+=(double)b*sqrt((b+c)*(b+c)/4.0-b*b/4.0);
printf("%.20f\n",sum);
}
} |
#include "bits/stdc++.h"
using namespace std;
using ld = long double;
const ld eps = 1e-9;
int main() {
cout << fixed << setprecision(10);
ld a, l, x;
while (cin >> a >> l >> x) {
ld h = sqrt(powl(l, 2) - powl(a / 2, 2));
ld w = sqrt(powl((l + x) / 2, 2) - powl(l / 2, 2));
ld ans = a*h / 2 + l*w;
cout << ans << endl;
}
return 0;
} |
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
double a, l, x;
while (cin >> a >> l >> x) {
double h_1 = sqrt(l * l - (a/2) * (a/2));
double m = a * h_1 / 2;
double h_2 = sqrt(((x + l)/2)* ((x + l)/2) - (l/2) * (l/2));
double s = l * h_2 / 2;
printf("%.6f\n", m + s * 2);
}
return 0;
} |
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
double h(double a,double b,double c){
double s=(a+b+c)*0.5;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
double a,l,x;
while(cin>>a>>l>>x)
cout<<fixed<<h(a,l,l)+h(l,(l+x)*0.5,(l+x)*0.5)*2<<endl;
return 0;
} |
#include<cstdio>
#include<cmath>
int main(){for(float a,l,x;~scanf("%f%f%f",&a,&l,&x);printf("%.9f\n",sqrt(l*l-a*a/4)*a/2+sqrt(x*x/4-l*l/4)*l))x+=l;} |
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
double a, l, x;
double temp1, temp2;
double center, sides;
while (cin >> a >> l >> x){
temp1 = sqrt(pow(l, 2) - pow(a / 2, 2));
center = a * temp1 / 2;
temp2 = sqrt(pow((l + x) / 2, 2) - pow(l / 2,2));
sides = temp2 * l;
printf("%10.10f\n", center + sides);
}
} |
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
double calcSurfaceArea( double a, double b, double c )
{
double cosA = ( b * b + c * c - a * a ) / ( 2 * b * c );
double sinA = sqrt( 1 - cosA * cosA );
return 0.5 * c * b * sinA;
}
int main()
{
int a, l, x;
while( cin >> a >> l >> x )
{
double max = 0;
for( double i = 0.01; i < l + x; i += 0.01 )
{
double s = calcSurfaceArea( i, l, l + x - i );
if( s > max )
max = s;
}
cout << fixed << setprecision(10) << max + max + calcSurfaceArea( a, l, l ) << endl;
}
return 0;
}
|
#include <stdio.h>
#include <math.h>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"
using namespace std;
int main(void){
int a,l,x;
for(;scanf("%d%d%d",&a,&l,&x)>0;){
double h=sqrt(l*l-a*a/4.0);
double u=sqrt((l+x)*(l+x)-l*l)/2.0;
printf("%.15f\n",a*h/2+l*u);
}
}
|
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
double a, l, x;
while( scanf("%lf %lf %lf", &a, &l, &x) != EOF ){
double ABC = 0.5 * a * sqrt( l * l - (a/2.0) * (a/2.0));
double ADC = 0.5 * l * sqrt( ((l+x)/2.0) * ((l+x)/2.0) - (l/2.0) * (l/2.0) );
double ans = ABC + 2.0 * ADC;
printf("%.10f\n", ans);
}
} |
#include <iostream>
#include <cmath>
using namespace std;
int main() {
double a, l, x;
cout.precision(10);
while (cin >> a >> l >> x) {
double area = sqrt(l * l - a * a / 4.0) * a / 2.0 + sqrt((l + x) * (l + x) / 4.0 - l * l / 4.0) * l;
cout << fixed << area << endl;
}
return 0;
} |
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;
int main()
{
for(;;){
double a, l, x;
if(!(cin >> a >> l >> x))
return 0;
double y = sqrt((x * x + 2 * l * x) / 4.0);
double z = sqrt(l * l - a * a / 4.0);
double ret = l * y + a * z / 2.0;
printf("%.10f\n", ret);
}
} |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main(int argc, char *argv[]) {
double a, l, x;
while (cin >> a >> l >> x) {
double abc = a * l * sqrt(1 - a/2/l * a/2/l) / 2;
double acd = l * (l+x)/2 * sqrt(1 - l/(l+x) * l/(l+x)) / 2;
printf("%.10lf\n", abc + acd*2);
}
return 0;
} |
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
double a, l, x;
while (scanf("%lf %lf %lf", &a, &l, &x) != EOF){
double A = a * sqrt(l * l - a * a / 4) / 2;
double B = l * sqrt((l + x) * (l + x) / 4 - l * l / 4) / 2;
printf("%.10lf\n", A + B + B);
}
return 0;
} |
#include<bits/stdc++.h>
using namespace std;
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
typedef long long ll;
typedef pair<int, int> ii;
int main() {
int a, l, x;
while(cin >> a >> l >> x){
double ans = 0;
double s = (a + l + l) / 2.0;
ans += sqrt(s * (s-a) * (s-l) * (s-l));
s = (4 * l + x + x) / 4.0;
ans += (2 * sqrt(s * (s-l) * (s-((l + x)/2.0)) * (s-((l + x)/2.0)) ) );
printf("%.6lf\n", ans);
}
return 0;
} |
#include<iostream>
#include<iomanip>
#include<complex>
using namespace std;
#define EPS 1e-10
double area2( double a, double b, double c){
double s = ( a + b + c ) / 2;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
int main(){
int a, l, x;
while(cin >> a >> l >> x){
double h = (l + x) / 2.0; // たぶん真ん中でしょ
cout << fixed << setprecision(6) << area2(a,l,l) + area2(h,h,l)*2 + EPS << endl;
}
} |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
double s(double a,double b,double c){
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
double a,l,x;
while(cin >> a >> l >> x){
double y = (l+x)/2;
printf("%.15f\n",s(a,l,l)+s(y,y,l)*2);
}
return 0;
} |
#include<cstdio>
#include<cmath>
using namespace std;
double h(double a,double b,double c){
double s = (a+b+c)/2;
return sqrt( (s-a)*(s-b)*(s-c)*s );
}
int main(){
double a,l,x;
while(scanf("%lf%lf%lf",&a,&l,&x)!=EOF)
printf("%.8lf\n",h(l,l,a)+2*h((l+x)/2,(l+x)/2,l));
} |
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
double heron(double a,double b,double c){
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
double a,l,x;
while(cin >> a >> l >> x){
double t = (l+x)/2;
printf("%.10f\n", heron(a,l,l)+heron(t,t,l)*2);
}
return 0;
} |
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
double T(double a,double b,double c){
double s=(a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
double a,l,x;
while(cin>>a>>l>>x){
double ans=T(a,l,l);
ans+=T(l,(l+x)/2.0,(l+x)/2.0);
ans+=T(l,(l+x)/2.0,(l+x)/2.0);
printf("%.12f\n",ans);
}
return 0;
}
|
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main() {
double a, l, x;
while (cin >> a >> l >> x) {
x = (l+x) / 2.0;
double s1, s2;
double M1, M2;
s1 = (a + l*2.0) / 2.0;
s2 = (l + x*2.0) / 2.0;
M1 = sqrt(s1 * (s1 - a) * (s1 - l) * (s1 - l));
M2 = sqrt(s2 * (s2 - l) * (s2 - x) * (s2 - x));
printf("%.10f\n", M1+M2*2);
}
return 0;
} |
//59
#include<iostream>
#include<cmath>
using namespace std;
int main(){
for(double a,l,x;cin>>a>>l>>x;){
double s=l+x/2;
cout<<fixed<<sqrt((l+a/2)*a/2*a/2*(l-a/2))+2*sqrt(s*(s-l/2-x/2)*(s-l/2-x/2)*x/2)<<endl;
}
return 0;
} |
#include <stdio.h>
#include <math.h>
int main(){
double a,l,x,hon,yoko;
while(scanf("%lf %lf %lf",&a,&l,&x) != EOF){
hon=sqrt(l*l-a*a/4)*a/2;
yoko=sqrt((l*l+2*l*x+x*x)/4-l*l/4)*l;
printf("%f\n",hon+yoko);
}
return 0;
} |
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
double area(double a, double b, double c) {
double s = (a + b + c) / 2;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
int main() {
int a, l, x;
while (cin >> a >> l >> x) {
double s = area(a, l, l) + 2 * area(l, (l + x) / 2.0, (l + x) / 2.0);
printf("%.6f\n", s);
}
} |
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
double a,l,x;
while(cin>>a>>l>>x){
double ans=0;
double kaku=acos((l*l*2-a*a)/(2*l*l));
ans+=l*l*sin(kaku)/2;
double ll=l+x;
ll/=2;
double high=sqrt(ll*ll-l*l/4);
ans+=l*high;
printf("%.10f\n",ans);
}
} |
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
double l,a,x;
while(cin>>a>>l>>x){
double M=(a*sqrt(l*l-(a/2)*(a/2)))/2;
double S=(l*sqrt(((l+x)/2)*((l+x)/2)-(l/2)*(l/2)))/2;
printf("%.6f\n",M+2*S);
}
return 0;
} |
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main(void){
double a,l,x;
double h,s;
while(cin>>a>>l>>x){
s=sqrt(a*a*(double)l*(double)l/4.0-a*a*a*a/16.0);
h=sqrt(pow((l+x)/2.0,2)-l*l/4.0);
s+=h*l;
printf("%.10f\n",s);
}
} |
#include <bits/stdc++.h>
using namespace std;
#define EPS 0.00001
double calcS(double bottom, double l){
return ((double)bottom * sqrt(pow(l, 2) - pow((double)bottom/2, 2))) / 2;
}
int main(void){
int a, l, x;
while(cin >> a >> l >> x){
double dflt = calcS(a, l);
double added = calcS(l, ((double)l+x)/2);
printf("%.7f\n", dflt + added * 2 );
}
return 0;
} |
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
double area(double a, double b, double c)
{
double s = (a+b+c)/2.0;
return sqrt(s * (s-a) * (s-b) * (s-c));
}
int main()
{
int a, l, x;
double s0, area0;
double sa, area_slack;
while (cin >> a >> l >> x)
{
area0 = area(a, l, l);
area_slack = area(l, (l+x)/2.0, (l+x)/2.0);
printf("%.10f\n", area0 + 2 * area_slack);
}
return 0;
} |
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
double S(double a, double b, double c) {
double z = (a + b + c) / 2;
return sqrt(z * (z-a) * (z-b) * (z-c));
}
int main() {
int a, l, x;
while (scanf("%d%d%d", &a, &l, &x) != EOF) {
double b = (l+x) / 2.0;
printf("%.8f\n", S(a, l, l) + 2 * S(l, b, b));
}
} |
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdio>
using namespace std;
int main()
{
double a, l, x, d1, d2, lx;
while(cin >> a >> l >> x)
{
lx = l + x;
d1 = a * sqrt(l * l - a * a /4) /2;
d2 = l * sqrt(lx * lx - l * l) / 2;
printf("%.6f\n", d1 + d2) ;
}
return 0;
} |
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double calc(double a,double b,double c){
double s=(a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
int a,b,c;
while(~scanf("%d%d%d",&a,&b,&c)){
printf("%.12f\n",calc(a,b,b)+calc(b,0.5*(b+c),0.5*(b+c))*2);
}
} |
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
vector<string> res;
for(int i=0,s=0;i<SIZE(str);i++){
if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
}
return res;
}
double calcS(double a,double b,double c){
double s=(a+b+c)/2.0;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
int a,l,x;
while(cin>>a>>l>>x){
double res=calcS(a,l,l)+calcS(l,(l+x)/2.0,(l+x)/2.0)*2;
printf("%.10f\n",res);
}
return 0;
} |
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
int a,l,x,i=0;
double M[100000],c,d,e,f;
while(scanf("%d%d%d",&a,&l,&x) != EOF){
c=(double)((2*x*l)+(x*x))/4;
e=l*l-(double)(a*a)/4;
d=sqrt(c);
f=sqrt(e);
M[i]=((double)a/2)*f+l*d;
i++;
}
for(int j=0 ; j < i ; j++){
printf("%.10f\n",M[j]);
}
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000 + 0;
//{{{ templates
#define TT_ template<typename T>inline
#define TTF_ template<typename T,typename F>inline
TT_ T sq(T x){return x*x;}
TT_ T In(){T x;cin>>x;return x;}
TT_ void Out(T&x){cout<<x;}
TT_ void sort(T&v){sort(begin(v),end(v));}
TT_ void revs(T&v){reverse(begin(v),end(v));}
TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT_ int ubnd(T&v,typename T::value_type&x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT_ int lbnd(T&v,typename T::value_type&x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
TT_ typename T::iterator minel(T&v){return min_element(begin(v),end(v));}
TT_ typename T::iterator maxel(T&v){return max_element(begin(v),end(v));}
inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}
//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple
ld area(ld a, ld b, ld c)
{
ld s = (a + b + c) / 2.0;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
ld max_area(int l, int x){
ld r = 0;
for (ld i = 0.1; i < l + x; i += 0.1){
ld a = l + x - i;
r = max(r, area(l, i, a));
}
return r;
}
int main()
{
int a, l, x;
while (~scanf("%d %d %d", &a, &l, &x)){
printf("%.10Lf\n", area(a, l, l) + 2 * max_area(l, x));
}
return 0;
} |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
typedef double dou;
dou area(dou a, dou b, dou c){
dou s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
dou a,l,x;
while(cin >> a >> l >> x){
dou s1 = area(l,l,a);
dou t = (l+x)/2;
dou s2 = area(t,t,l);
printf("%.10f\n",s1 + 2*s2);
}
} |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main() {
double a, l, x;
while (cin >> a >> l >> x) {
double dM = l * sqrt(x*x+2*l*x) * 0.5;
double A = a * sqrt(l*l - a*a*0.25) * 0.5;
printf("%.8lf\n", dM + A);
}
return 0;
} |
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
double a,l,x;
while(cin >> a >> l >> x){
double s=0;
s += a*sqrt(l*l-a*a/4)/2;
double L = (x+l) / 2.0;
s += l * sqrt( L*L -l*l/4);
printf("%.10lf\n",s);
}
} |
#include<cmath>
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
double a,l,x;
while(cin>>a>>l>>x){
printf("%.10lf\n",sqrt(l*l-(a/2)*(a/2))*a/2+sqrt(((l+x)/2)*((l+x)/2)-(l/2)*(l/2))*l);
}
return 0;
} |
#include <iostream>
#include <complex>
#include <cmath>
#include <cstdio>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;
double heron(double a, double b, double c) {
double s = (a + b + c) / 2.0;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
int main() {
double a, l, x;
cout << setprecision(20);
while(cin >> a >> l >> x) {
cout << heron(l, l, a) + 2 * heron(l, (l + x) / 2.0, (l + x) / 2.0) << endl;
}
return 0;
} |
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
double heron(double a, double b, double c) {
const double s = (a + b + c) / 2.0;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
int main() {
for(int a, l, x; scanf("%d %d %d", &a, &l, &x) == 3;) {
const double half = (l + x) / 2.0;
const double ans = heron(a, l, l) + 2.0 * heron(l, half, half);
printf("%.10lf\n", ans);
}
return EXIT_SUCCESS;
} |
#include <iostream>
#include <cstdio>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair
static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;
template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T &t = T()){
v.assign(a,vector<T>(b,t));
}
//v.erase(unique(v.begin(),v.end()),v.end());
long double foo(long double a,long double b){
long double s=a/2.0+b;
long double ret=sqrt(s*(s-a)*(s-b)*(s-b));
return ret;
}
int main(){
long double a,l,x;
while(cin>>a>>l>>x){
long double ans=foo(a,l);
ans+=foo(l,(l+x)/2.0)*2.0;
printf("%.10Lf\n",ans);
}
} |
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <stack>
#include <array>
#include <fstream>
#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPA(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#if defined(_MSC_VER)||__cplusplus > 199711L
#define AUTO(r,v) auto r = (v)
#else
#define AUTO(r,v) typeof(v) r = (v)
#endif
#define ALL(c) (c).begin() , (c).end()
#define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();++it)
#define LL long long
#define int LL
#define INF 99999999
#define DEV 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
double A, L, X;
signed main()
{
QUICK_CIN;
//ifstream cin("debug.txt");
//ofstream cout("result.txt");
while (cin >> A >> L >> X){
double S = 0;
S = L/2*sqrt(2 * L*X + X*X) + A / 4 * sqrt(4 * L*L - A*A);
printf("%.10lf\n", S);
}
} |
#include<iostream>
#include<cstdio>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
int main(){
double a,l,x;
while(cin>>a>>l>>x){
double ans=a*sqrt(4*l*l-a*a)/4+l*sqrt(x*(2*l+x))/2;
printf("%.9f\n",ans);
}
return 0;
} |
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
double a, l, x;
int main() {
while (cin >> a >> l >> x) {
double h = sqrt(x*x / 4 + x*l / 2);
double area = l*h + 0.5*a*sqrt(l*l - a*a/4);
printf("%.8f\n", area);
}
} |
#include<cstdio>
#include<cmath>
int main(){for(float a,l,x,s;~scanf("%f%f%f",&a,&l,&x);printf("%.9f\n",sqrt(l*l-a*a/4)*a/2+sqrt(x*x/4-l*l/4)*l))x+=l;} |
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
double a, l, x;
while(cin >> a >> l >> x){
double len = sqrt(l * l - (a / 2.0) * (a / 2.0));
double b = (l + x) / 2.0;
double s = (b + b + l) / 2.0;
printf("%.10f\n", a * len / 2.0 + sqrt(s * (s - b) * (s - b) * (s - l)) * 2.0);
}
} |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
double heron(double a, double b, double c) {
double s=(a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main() {
double a,l,x;
while(cin>>a>>l>>x)
printf("%.6f\n", heron(a,l,l)+2*heron(l,(l+x)/2,(l+x)/2));
return 0;
} |
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
double a,l,x;
double s;
while(~scanf("%lf%lf%lf",&a,&l,&x)){
x+=l;
s = sqrt(l*l - a*a/4.0) * a / 2.0;
s += sqrt(x*x/4.0 - l*l/4.0) * l;
printf("%.10f\n",s);
}
} |
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef long long ll;
#define dump(x) cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define sz size()
const double EPS = 1e-10;
const int INF = 100000000;
int main(){
double a,l,x;
while(cin>>a>>l>>x){
double ans=0.5*a*sqrt(l*l-(a*a)*0.25) + 0.5*l*sqrt(x*x+2*l*x) ;
printf("%15.10lf\n",ans);
}
return 0;
} |
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
double calc(double a,double b,double c){
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
void func(double a,double l,double x){
double tmp = (l+x)/2;
printf("%.10lf\n",calc(a,l,l)+calc(tmp,tmp,l)*2);
}
int main(){
double a,l,x;
while(scanf("%lf %lf %lf",&a,&l,&x) != EOF){
func(a,l,x);
}
} |
#include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
int a,l,x;
double s;
while(cin >> a){
cin >> l >> x;
s=sqrt(((l+x)*(l+x)-l*l)/4.0)*l+a*sqrt(l*l-a*a/4.0)/2.0;
printf("%.10f\n",s);
}
return 0;
} |
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
int a,l,x;
while(cin >> a >> l >> x){
double h = sqrt(l*l -a*a/4.0);
double y = sqrt((l+x)*(l+x) -l*l) /2.0;
cout << fixed << setprecision(10);
cout << a*h/2 +l*y << endl;
}
return 0;
}
|
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
long double a, l, x, p;
int main() {
while (cin >> a >> l >> x) {
long double z = sqrtl(l*l - a*a / 4); p = 0;
p += z*a / 2;
z = sqrtl((l + x)*(l + x) / 4 - l*l / 4);
p += z*l;
printf("%.15Lf\n", p);
}
return 0;
} |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
double s(double a,double b,double c){
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
double a,l,x;
while(cin >> a >> l >> x){
double y = (l+x)/2;
printf("%.15f\n",s(a,l,l)+s(y,y,l)*2);
}
} |
#include <bits/stdc++.h>
using namespace std;
int main(){
double a, l, x;
while(scanf("%lf%lf%lf", &a, &l, &x) != EOF){
double s_abc = a * sqrt(l * l - a * a / 4) / 2;
double s_acd = l * sqrt(2 * l * x + x * x) / 4;
printf("%.12f\n", s_abc + 2 * s_acd);
}
return 0;
} |
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<deque>
#include<sstream>
#include<iomanip>
#include<sstream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<climits>
#include<map>
#include<set>
#include<list>
#include<cassert>
#include<deque>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<27
#define all(n) n.begin(),n.end()
#define insert(a,b,c,d) PP(P(a,b),P(c,d))
#define F first
#define S second
#define pb push_back
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> PP;
typedef long long ll;
typedef unsigned long long ull;
double heroin(double a,double b,double c){
double s = (a+b+c)*0.5;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
double a,l,x;
while(cin >> a >> l >> x)
{
double area = heroin(a,l,l);
area += 2*heroin(l,(l+x)*0.5,(l+x)*0.5);
cout << setiosflags(ios::fixed) << setprecision(10) << area << endl;
}
return 0;
} |
#include<iostream>
#include<cstdio>
#include<complex>
using namespace std;
double area(double a, double b) {
return sqrt((a / 2 + b) * (-a / 2 + b) * a * a / 4);
}
int main() {
double a, l, x;
while (cin >> a >> l >> x) {
printf("%.12f\n", area(a, l) + area(l, (l + x) / 2) * 2);
}
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a,l,x;
while(cin >> a >> l >> x) {
double b=sqrt(l*l-(a/2)*(a/2));
double c=(l+x)/2;
double d=sqrt(c*c-(l/2)*(l/2));
printf("%.10f\n",a*b/2+l*d);
}
return 0;
}
|
// AOJ 1091
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
int main(void)
{
double a, l, x;
while (scanf("%lf %lf %lf", &a, &l, &x) != EOF){
double s = 0, ret = 0;
s = (a + l + l) / 2.0;
ret += sqrt(s * (s - a) * (s - l) * (s - l));
s = (l + l + x) / 2.0;
ret += (sqrt(s * (s - l) * (s - ((l + x) / 2.0)) * (s - ((l + x) / 2.0))) * 2.0);
printf("%.08lf\n", ret);
}
return 0;
} |
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main() {
int A,L,X;
while(cin>>A>>L>>X) {
double a = A, l = L, x = X;
double th = acos(a/(2*l));
double centM = (a*l*sin(th))/2;
double ph = acos(l/(l+x));
double sideM = l*(l+x)*sin(ph)/2;
printf("%.10f\n", sideM + centM);
}
return 0;
} |
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;
#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }
double Area(double a, double b, double c) {
double s = (a+b+c)/2;
double res = s*(s-a)*(s-b)*(s-c);
if (res > 0) return sqrt(res);
else return 0;
}
double a, l, x;
int main() {
while (cin >> a >> l >> x) {
double res = Area(a, l, l) + Area((l+x)/2, (l+x)/2, l) * 2;
cout << fixed << setprecision(9) << res << endl;
}
return 0;
}
|
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
long double f(int x, int y) {
return x * sqrtl(y * y - x * x / 4.0L) / 2;
}
int a, l, x;
int main() {
while(cin >> a >> l >> x) {
cout << fixed << setprecision(20) << f(a, l) + f(l * 2, l + x) / 2 << endl;
}
} |
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
int main(){
double a,l,x;
while(cin>>a>>l>>x){
double b,c;
b=(double)sqrt((double)l*l-a*a/4);
c=(double)sqrt((double)(l+x)*(l+x)-l*l);
cout<<fixed<<setprecision(10)<<a*b/2+l*c/2<<endl;
}
return 0;
} |
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
using ll = long long;
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double s(double x, double y) { return x * sqrt(y * y - (x / 2) * (x / 2)) / 2; }
double a, l, x;
int main() {
while (cin >> a >> l >> x) {
double ans = s(a, l);
ans += s(l, (l + x) / 2);
ans += s(l, (l + x) / 2);
printf("%.12f\n", ans);
}
return 0;
} |
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main() {
int a,l,x;
while(cin >> a >> l >>x) {
double h = l*l-(a/2.0)*(a/2.0);
h = sqrt(h);
double s = a * h / 2.0;
h = ((l+x)/2.0)*((l+x)/2.0)-(l/2.0)*(l/2.0);
h = sqrt(h);
s += l*h;
// cout << h << endl;
//cout << s << endl;
printf("%.10f\n",s);
}
return 0;
} |
#include<bits/stdc++.h>
using namespace std;
double heron(double a,double b,double c){
double s=(a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
double a,l,x;
while(cin>>a>>l>>x){
double a1=heron(a,l,l);
double a2=heron(l,(l+x)/2,(l+x)/2);
printf("%.10f\n",a1+a2*2);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.