求助,#10没过
查看原帖
求助,#10没过
449340
Qianxue_Shuimin楼主2025/6/30 16:59

就很生草,不清楚哪里出了问题


看不到数据,悲哀

#include <iostream>
#include <iomanip>
#include <cmath>

int main() {

    double s, v = 0;

    std::cin >> s >> v;

    int i = 470;

    int i_ = (ceil(s / v));

    if (i_ < 470) {
        int i_ = i - (ceil(s / v));

        int h = floor(i_ / 60);
        int m = i_ % 60;

        if (h < 10) {

            if (m < 10) {
                std::cout << "0" << h << ":" << "0" << m << std::endl;
            } else {
                std::cout << "0" << h << ":" << m << std::endl;
            }
              
        } else if (h > 10 ) {
            if ( m < 10) {
                std::cout << h << ":" << "0" << m << std::endl;
            } else {
                std::cout << h << ":" << m << std::endl;
            }  
        }
    } else if (i_ > 470 && i_ < 1910) {
        i_ = i_ - 470;
        i = 1440;
        int h = floor((i - i_) / 60);
        int m =  60 - (i_ % 60);

        if (h < 10) {

            if (m < 10) {
                std::cout << "0" << h << ":" << "0" << m << std::endl;
            } else {
                std::cout << "0" << h << ":" << m << std::endl;
            }
              
        } else if (h > 10 ) {
            if ( m < 10) {
                std::cout << h << ":" << "0" << m << std::endl;
            } else {
                std::cout << h << ":" << m << std::endl;
            } 
        }
    } else if (i_ > 1910) {
        i_ = i_ - 470;
        i_ = i_ - (1440 * floor(i_ / 1440));
        i = 1440;
        int h = floor((i - i_) / 60);

        int m =  60 - (i_ % 60);
        
        if (i_ % 60 == 0) {
            m = 0;
        }

        if (h < 10) {

            if (m < 10) {
                std::cout << "0" << h << ":" << "0" << m << std::endl;
            } else {
                std::cout << "0" << h << ":" << m << std::endl;
            }
              
        } else if (h > 10 ) {
            if ( m < 10) {
                std::cout << h << ":" << "0" << m << std::endl;
            } else {
                std::cout << h << ":" << m << std::endl;
            } 
        }

    } else {
        std::cout << "00:00" << std:: endl;
    }

    return 0;
}
2025/6/30 16:59
加载中...