提交时间:2023-10-08 13:15:41
运行 ID: 105783
#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="<<i<<" dis="<<dis[8-i]<<".00 oil="<<oil[8-i]<<".00"<<endl; } }