1104 - t /= tree[i][0]; t /= (S - tree[i][0]); t = sqrt(t);...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> #include<iomanip> #include<cmath> using namespace std; enum { SIZ = 104, }; float tree[SIZ][2]; const float g = 9.8/2; float pi ; float S; int num; void readIn(){ int i; float py =0, px = 0; float y,x; cin>>py>>px; num--; for(i=0;i<num;i++){ cin>>y>>x; if(y > py){ py = y; } tree[i][0] = px; tree[i][1] = py; py = y; px += x; } S = px; } void fun(){ float up = 0,left, t; for(int i=0;i<num;i++){ t = tree[i][1] * g * S * S;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t /= tree[i][0]; t /= (S - tree[i][0]); t = sqrt(t); if(t &gt; up) up = t; } left = g * S; left /= up; up = up * up + left * left; up = sqrt(up); t = acos(left/up); t *= 180; t /= pi; cout&lt;&lt;setiosflags(ios::fixed)&lt;&lt;setprecision(2) &lt;&lt;t&lt;&lt;&quot; &quot;&lt;&lt;up&lt;&lt;endl; } int main(){ pi = asin(1.0) * 2; while(cin&gt;&gt;num){ readIn(); fun(); } return 0; }...
View Full Document

This note was uploaded on 02/18/2010 for the course CS 100 taught by Professor Acm during the Spring '10 term at Zhejiang University.

Page1 / 2

1104 - t /= tree[i][0]; t /= (S - tree[i][0]); t = sqrt(t);...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online