結果

問題 No.651 E869120 and Driving
ユーザー kichirb3kichirb3
提出日時 2018-02-25 23:05:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,022 bytes
コンパイル時間 1,005 ms
コンパイル使用メモリ 114,768 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 07:52:13
合計ジャッジ時間 1,608 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.651 E869120 and Driving
// https://yukicoder.me/problems/no/651
//
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <regex>
#include <utility>
#include <unordered_map>
#include <map>
#include <set>
#include <regex>
#include <iomanip>
#include <sstream>
#include <array>
using namespace std;

string solve(int a);


int main() {
    int a;
    cin >> a;
    string ans = solve(a);
    cout << ans << endl;
}


string solve(int a) {
    int start_time = 10 * 60;   // 出発時刻 (00:00からの経過分)
    int arrive_time = start_time + (a * 60 / 100 ); // 到着時刻

    int arrive_mm = arrive_time % 60; // 到着時刻の分部分
    int arrive_hh = arrive_time - arrive_mm; // 到着時刻の時部分
    arrive_hh /= 60;
    arrive_hh %= 24;

    stringstream ss;            // XX:YY フォーマットの文字列に整形
    ss << setw(2) << setfill('0') << arrive_hh << ":";
    ss << setw(2) << setfill('0') << arrive_mm;
    return ss.str();
}
0