链接http://acm.swust.edu.cn/problem/0046/
#include <stdio.h> int main() { double m; int n; double distance=0; scanf("%lf %d",&m,&n); while(n--) { distance+=m+m/2; m/=2; } printf("%.2lf %.2lf\n",m,distance-m); return 0; }
时间: 2024-12-09 01:18:15
链接http://acm.swust.edu.cn/problem/0046/
#include <stdio.h> int main() { double m; int n; double distance=0; scanf("%lf %d",&m,&n); while(n--) { distance+=m+m/2; m/=2; } printf("%.2lf %.2lf\n",m,distance-m); return 0; }