C++ 90分求助!倒数第二个样例没过
查看原帖
C++ 90分求助!倒数第二个样例没过
370808
themysteryboy楼主2023/8/3 19:24
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <vector>

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);

  int s, v;
  std::cin >> s >> v;

  int ans = ceil(s / v) + 10;
  int h, min;
  h = ans / 60;
  min = ans % 60;

  if (h > 7 && h < 19) {
    h -= 7;
    std::cout << std::setw(2) << std::setfill('0') << (24 - h) << ':' << std::setw(2) << std::setfill('0') << (59 - min) << '\n';
  } else if (h <= 7) {
    std::cout << std::setw(2) << std::setfill('0') << (7 - h) << ':' << std::setw(2) << std::setfill('0') << (59 - min) << '\n';
  } else {
    h -= 19;
    std::cout << std::setw(2) << std::setfill('0') << (12 - h) << ':' << std::setw(2) << std::setfill('0') << (59 - min) << '\n';
  }

  return 0;
}
2023/8/3 19:24
加载中...