# Model Rocket Height 2007

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 This problem has been solved by hjfreyer.

 Sorter: hjfreyer GNYR ICPC 2007 http://www.acmgnyr.org/year2007/G.pdf

This is problem G from the GNYR ICPC 2007

This was a pain. But kind of cool in retrospect.

{{#for: 7 |*{{#vardefine:odd|{{#expr: {{#var:odd}} + 1}}}}{{#var:odd}}}}

## Code

```import java.util.*;

public class Main{
public static Scanner in;
public static void main(String[] args){
in = new Scanner(System.in);
doStuff();
}

public static void doStuff(){
int N = in.nextInt();
double D = in.nextDouble();
double L = in.nextDouble();
double HA = in.nextDouble();
double HB = in.nextDouble();
double ERRDIST = in.nextDouble();
for(int i = 1; i <=N; i++){
System.out.print(i+" ");
double alpha= in.nextDouble();
double beta= in.nextDouble();
double gamma= in.nextDouble();
double delta= in.nextDouble();
solve(D,L,HA,HB,ERRDIST,alpha,beta,delta,gamma);

}

}

public static void solve(double D,
double L,
double HA,
double HB,
double ERRDIST,
double alpha,
double beta,
double delta,
double gamma){
if(alpha < 0 || alpha > 90 ||beta < 0 || beta > 90 || gamma < 0 || gamma > 90 || delta < 90 || delta > 180 ){
System.out.print("DISQUALIFIED\n");

}

else{
delta = 180.0 - delta;
double ang =(double)( 180.0 -(delta + gamma));

double L1 = SA + tau;

double L2 = SB + theta;

double diff = Math.abs(A4-B4);

if(diff <= ERRDIST){
int ans = (int)Math.round(diff/2 + Math.min(A4, B4));
System.out.printf("%d\n",ans );

}

else{
System.out.print("ERROR\n");
}
}
}
}

```