460

#include <iostream> #include <cstdlib> #include <cmath> #include <cstdio> using namespace std; struct point{ int x,y; }; point LL1,LL2,LR1,LR2,UL1,UL2,UR1,UR2; point New_LL,New_LR,New_UL,New_UR; bool isOverlap() { if(LL1.x>=LR2.x) return 0; if(LR1.x<=LL2.x) return 0; if(LL1.y>=UL2.y) return 0; if(UL1.y<=LL2.y) return 0; return 1; } bool isTotalInside() { if((LL1.x>=LL2.x && LL1.x <= UR2.x) && (LL1.y>=LL2.y && LL1.y <= UR2.y)) { if((LR1.x>=LL2.x &&

11909

#include <iostream> #include <cmath> #include <cstdio> #define PI acos(-1) using namespace std; //using the formulae a/sin A = b/sin B = c/sin C int main() { double L,W,H,angle; double changed_hight,res,changed_base,empty_area; while(scanf("%lf%lf%lf%lf",&L,&W,&H,&angle)!=EOF) { changed_hight= sin(angle*PI/180)*L/sin((90-angle)*PI/180); if(angle==0) { printf("%.3lf mL\n",L*W*H); } else if(angle==90) { printf("%.3lf mL\n",0); } else if(changed_hight<=H) { empty_area=changed_hight*L*W/2; res = L*W*H-empty_area; printf("%.3lf mL\n",res); }

10209

To get accepted I had to use PI = acos(-1). Lets assume X = middle portion; Y = dotted region; Z = stripped region; Three independent equations are: X+ 4*Y + 4*Z = a*a……………………………………………….(1) Y + 2*Z = a*a – PI*a*a/4………………………………………..(2) X/2 + Y + Z/2 = (PI*a*a)/4 – ΔPAR………………………..(3) #include <iostream> #include <cstdio> #include <cstdio>

12779

#include <stdio.h> #include <iostream> #include <math.h> using namespace std; #define eps 1e-6 #define MX 1000000000 #define ll long long struct POINT{int x,y;}; long long gcd(ll a,ll b) { if(a%b==0) return b; else return gcd(b,a%b); } POINT pp[4]; bool find_perp_distance(POINT u,POINT v,POINT s,ll &B,ll &C,double &val) { //form equation of st line uv (ax+by+c=0) double a,b,c,r;

12816

#include <iostream> #include <math.h> //#include <string> using namespace std; struct point{ double x; double y; }p[101]; int isIsosceles(int a,int b,int c) { //dist of p[a],p[b] double d1 = sqrt((p[a].x-p[b].x)*(p[a].x-p[b].x) + (p[a].y-p[b].y)*(p[a].y-p[b].y)); double d2 = sqrt((p.x-p[b].x)*(p.x-p[b].x) + (p.y-p[b].y)*(p.y-p[b].y)); double d3 = sqrt((p[a].x-p.x)*(p[a].x-p.x) + (p[a].y-p.y)*(p[a].y-p.y)); //cout<<d1<<" "<<d2<<" "<<d3<<"\n"; if((d1+d2)<=d3 || (d3+d1)<=d2 || (d3+d2)<=d1) return 0; else if(d1==d2

356

#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int main() { double n,m,d1,d2; int cnt,n_cnt,c=0; while(cin>>n) { m=(n-0.5)*(n-0.5); cnt=0; n_cnt=0; for(int i=0;i<=n;i++) { for(int j=0;j<=n;j++) { d1=i*i+j*j; d2=(i+1)*(i+1)+(j+1)*(j+1); if(d1<m && d2<=m) { //cout<<i<<" "<<j<<" "<<i+1<<" "<<j+1<<"\n"; cnt++; } else if(d1<m && d2>m) n_cnt++; } } if(c) cout<<"\n"; c=1; cout<<"In the case n = "<<n<<",

378

#include <cmath> #include <iostream> #include <stdio.h> #define INF 1000000000 using namespace std; int n; int c=1; double m1,m2,d,d1,d2,x1,x2,x3,x4,y_1,y2,y3,y4,c1,c2; double px,py; void intersect() { if(x1!=x2) { m1=((y_1-y2)/(x1-x2)); } else { m1=INF; } if(x3!=x4) m2=(y3-y4)/(x3-x4); else m2=INF; if(m1==INF) c1=0; else c1=y_1-m1*x1; if(m2==INF) c2=0; else c2=y3-m2*x3; if(m1==INF) { px=x1; if(m2==0) { py=y3; printf("POINT %.2lf %.2lf\n",px,py); return; } else