幾何

10026 - Standard Deviation

#include <cmath> #include <cstdio> #include <iostream> using namespace std; void Slove(int n) { int s[n]; double m, variance=0.0; for (int i=0; i<n; ++i) { cin >> s[i]; m+=s[i]; } m/=n; for (int i=0; i</n;></iostream></cstdio></cmath>

10025 - Triangle

#include <cmath> #include <cstdio> #include <iostream> using namespace std; void Slove(double a, double b, double angle) { double rad=(angle/180)*M_PI; double S=a*b*sin(rad)/2; double L=a+b+sqrt( pow(a,2)+pow(b,2)-2*a*b*cos(rad) ); double h=b*sin(rad); printf ("%.</iostream></cstdio></cmath>…

10024 - Distance

#include <cmath> #include <cstdio> #include <iostream> using namespace std; void Slove(double x1, double y1, double x2, double y2) { printf ( "%.8lf\n", sqrt( pow(x2-x1,2)+pow(y2-y1,2) ) ); } int main(void) { double x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; Slo</iostream></cstdio></cmath>…

0059 - Intersection of Rectangles

#include <iostream> using namespace std; void Slove(double xa1, double ya1, double xa2, double ya2, double xb1, double yb1, double xb2, double yb2) { cout << (xa1<=xb2 && xb1<=xa2 && ya1<=yb2 && yb1<=ya2? "YES" : "NO") << endl; } int main(void) { do</iostream>…

0057 - The Number of Area

#include <iostream> using namespace std; void Slove(int n) { cout << (n*n+n+2)/2 << endl; } int main(void) { int n; while (cin >> n) Slove(n); return 0; } 階差数列.....</iostream>