70分求助

P5707 【深基2.例12】上学迟到

I_love_big_ba_lei_te @ 2024-10-05 19:22:03

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  int time=8*60-10;
  int sum=0;
  while(a>0)
    {
        a=a-b;
        sum++;
    }
  time=time-sum;
  sum=0;
  while(time>60)
    {
        time=time-60;
        sum++;
    }
  if(sum<10)
    cout<<"0"<<sum<<":";
  if(sum>=10)
    cout<<sum<<":";
  if(time<10)
    cout<<"0"<<time;
  if(time>=10)
    cout<<time;
  return 0;
}

|