求助,怎么只有80分

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

农民傻了 @ 2024-09-23 18:42:45

#include <bits/stdc++.h>
using namespace std;
double s,v;
int main()
{
  cin>>s>>v;
  int t2=10+ceil(s/v);
  if(t2<=60)
  {
    cout<<"07"<<':'<<60-t2;
  }
  else
  {
    int h=floor(t2/60);
    int min=t2-h*60;
    if(h<=7)
    {
        cout<<'0'<<7-h<<':'<<60-min;
    }
    else
    {
        if(31-h>=10)
        cout<<31-h<<':'<<60-min;
        else
        {
            cout<<'0'<<31-h<<':'<<60-min;
        }
    }
  }
}
/*1 6
2  5
3 4
4 3
5 2
6 1
7 0
8 23
9 22
10 21
*/

/1 6 2 5 3 4 4 3 5 2 6 1 7 0 8 23 9 22 10 21 /


by yezicong1104 @ 2024-09-23 20:15:30

@农民傻了,分钟没补 0

#include <bits/stdc++.h>
using namespace std;
int main() {
    int s, v;
    cin >> s >> v;
    int tt = ceil((double)s / v) + 10; //耗时 
    int t = (480 - tt + 1440) % 1440;
    printf("%d%d:%d%d", t / 600, t / 60 % 10, t % 60 / 10, t % 60 % 10);
    return 0;
}

|