AOJ 0073
・問題リンク Surface Area of Quadrangular Pyramid
・コメント
四角錐の表面積を求めるプログラムをそのまま実装するだけでした。
・ソース
#include<iostream> #include<math.h> using namespace std; int main() { while(true){ double s=0; double x,h; cin>>x>>h; if(x==0&&h==0)break; s=x*x+(2*sqrt(h*h+((x*x)/4))*x); cout<<fixed; cout.precision(6); cout<<s<<endl; } return 0; }