90分求救

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

etachi @ 2024-02-15 15:40:18

#include<iostream>
using namespace std;
int sq(int a,int b){
    if(a%b==0)
    return a/b;
    else
    return a/b+1;
}
void out(int a){
    if(a<=10)
    cout<<"0"<<a;
    else
    cout<<a; 
}
int main(){
    int s,v,time,start,ans[3];
    cin>>s>>v;
    time=sq(s,v)+10;
    start=8*60;
    if(start<time)
    ans[0]=24*60+start-time;
    else
    ans[0]=start-time;
    ans[1]=ans[0]/60;
    ans[2]=ans[0]%60;
    out(ans[1]);
    cout<<":";
    out(ans[2]);
    return 0;
} 

最后一个测试点错误 求大牛教教我


|