70分,求助

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

Summer77777 @ 2024-10-03 18:52:39

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int s,v;
    cin>>s>>v;
    int n=s/v;
    if (s%v!=0) n++;
    int a=(470-n)/60;
    int b=(470-n)%60;
    cout<<setw(2)<<setfill('0') <<a<<":"<<setw(2)<<setfill('0')<<b<<endl;
return 0;

 }

by lvjie14 @ 2024-10-03 22:07:17

你的n>470的话会是负数


by Summer77777 @ 2024-10-07 19:24:37

@lvjie14 谢谢


|