C++ 90 最后一个测试点WA 求调
查看原帖
C++ 90 最后一个测试点WA 求调
1368189
znzryb楼主2024/8/1 09:58
#include <iostream>
#include <iomanip>
#include <math.h>

// int 有十位
int s,v,t,h,m;
using namespace std;
int main()
{
    cin >> s >> v;
            // 只有小数与整数的结果是小数
    t = ceil(static_cast<double>(s)/v)+10;
    h = floor(t/60);
    m = t % 60;
    // 对无min的进行特判
    if (m==0){
        if (h<=8){
            cout<<0<<8-h<<":"<<"00";
        }else if(h>8 and h<=20){
            cout<<24-(h-8)<<":"<<"00";
        }else{                      // 不要打两个数字00
            cout<<0<<24-(h-8)<<":"<<"00";
        }
    }else{
        if (h<=7){
            if (m<=50){
                cout<<0<<8-h-1<<":"<<60-m;
            }else{
                cout<<0<<8-h-1<<":"<<"0"<<60-m;
            }  
        
        }else if(h>7 and h<=19){
            if (m<=50){
                cout<<24-(h-8)-1<<":"<<60-m;
            }else{
                cout<<24-(h-8)-1<<":"<<"0"<<60-m;
            }    
        }else{
            if (m<=50){
                cout<<"0"<<24-(h-8)-1<<":"<<60-m;
            }else{
                cout<<"0"<<24-(h-8)-1<<":"<<"0"<<60-m;
            }  
        }
    }
    return 0;
}
2024/8/1 09:58
加载中...