#include <iostream> #include <iomanip> using namespace std; int main() { double x,h,k; int n; cin>>h>>n; x=h; k=h; for(int i=2;i<=n;i++) { h=h/2; x+=(h*2); } for(int j=1;j<=n;j++) { k=k/2; } cout<<fixed<<setprecision(1)<<x<<" "<<k<<endl; return 0; }
#include <iostream> #include <iomanip> using namespace std; int main() { double x,h,k; int n; cin>>h>>n; x=h; k=h; for(int i=2;i<=n;i++) { h=h/2; x+=(h*2); } for(int j=1;j<=n;j++) { k=k/2; } cout<<fixed<<setprecision(1)<<x<<" "<<k<<endl; return 0; }