0073 - Surface Area of Quadrangular Pyramid
#include <cmath> #include <cstdio> #include <iostream> using namespace std; void Slove(int x, int h) { printf ("%5lf\n", x*sqrt(4*h*h+x*x)+x*x); } int main(void) { int x, h; while ( cin >> x >> h && (x || h) ) Slove(x,h); return 0; }
正四角錐の公式一発