70分,求大佬解答

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

zhangdehenshuai3 @ 2024-12-03 12:48:18

include<bits/stdc++.h>

using namespace std; int main() { int s,v; scanf("%d %d",&s,&v);

int t1 = s/v;                      
double t2 = (double)s/v;
if(t2>t1)
{
    t1 ++;
}
int n = t1 + 10;

int a=8,b = 60;

if(n>60)
{
    a = a-1 - n / 60;
    b = b -(n-60*(n/60));
 } 
 else
 {
    a = 8-1;
    b = b - n;
 }

printf("%02d:%02d",a,b);
return 0;

**

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int s,v; 
    scanf("%d %d",&s,&v);

    int t1 = s/v;                      
    double t2 = (double)s/v;
    if(t2>t1)
    {
        t1 ++;
    }
    int n = t1 + 10;

    int a=8,b = 60;

    if(n>60)
    {
        a = a-1 - n / 60;
        b = b -(n-60*(n/60));
     } 
     else
     {
        a = 8-1;
        b = b - n;
     }

    printf("%02d:%02d",a,b);
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int s,v; 
    scanf("%d %d",&s,&v);

    int t1 = s/v;                      
    double t2 = (double)s/v;
    if(t2>t1)
    {
        t1 ++;
    }
    int n = t1 + 10;

    int a=8,b = 60;

    if(n>60)
    {
        a = a-1 - n / 60;
        b = b -(n-60*(n/60));
     } 
     else
     {
        a = 8-1;
        b = b - n;
     }

    printf("%02d:%02d",a,b);
    return 0;
}

|