提交时间:2023-10-07 14:04:27
运行 ID: 105697
#include<bits/stdc++.h> using namespace std; int main() { int dis[9],oil[9],k=-1,sum=0; dis[0]=1000; while(dis[sum]>0) { sum++;k+=2; dis[sum]=dis[sum-1]-500/k; oil[sum]=sum*500; } cout<<"i=0 dis=0.00 oil=3875.00"<<endl; for(int i=1;i<=sum-1;i++) { cout<<i<<" "<<dis[8-i]<<" "<<oil[8-i]<<" "<<endl; printf("i=%.2f dis=%.2f oil=%.2f\n",i,dis[8-i],oil[8-i]); } }