怎么才20分(#1、2)

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

chen_1111 @ 2024-04-20 12:00:34

#include<iostream>
using namespace std;
int main()
{
    int s,v,t,i;
    cin>>s>>v;
    t=s/v;
    if(s%v!=0)
    {
        t++;
    }
    i=750-t;
    if(i<0)
    {
        i+=2400;
    }
    if(i%100>60)
    {
        i-=40;
    }
    if(i/100<10)
    {
        cout<<"0";
    }
    cout<<i/100<<":"<<i%100;
    return 0;
}

by InfiniteRobin @ 2024-04-20 12:09:39

kanikan @123A123 看看我的吧

#include<bits/stdc++.h>
using namespace std;
int main(){
    double s,v;
    int t,h=7,m=50;
    cin>>s>>v;
    t=ceil(s/v);
    while(t--){
        m--;
        if(m==-1){
            m=59;
            h--;
        }
        if(h==-1){
            h=23;
        }
    }
    if(h<10){
        cout<<0;
    }
    cout<<h<<":";
    if(m<10){
        cout<<0;
    }
    cout<<m;
    return 0;
}

by zy20100206 @ 2024-04-20 12:55:15

@123A123 进位


|