2
100 1
100.0 2
100.00 50.00
200.00 25.00
#include<iostream> #include <cstdio> #include <cstring> #include <iomanip> using namespace std; int main() { int m,i; double h,n,sum,ne; cin>>m; while(m--) { cin>>h>>n; sum=h; ne=h/2; for(i=1;i<n;++i) { h/=2.0; sum+=2*h; ne/=2; } cout<<setiosflags(ios::fixed)<<setprecision(2); cout<<sum<<" "<<ne<<endl; } return 0; }
原文地址:http://blog.csdn.net/blue_skyrim/article/details/46639293