Advertisement
Spocoman

01. Sino The Walker

Feb 10th, 2024
1,114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <limits>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.     string line;
  10.     getline(cin, line);
  11.  
  12.     int hours = stoi(line.substr(0, line.find(':'))),
  13.         minutes = stoi(line.substr(line.find(':') + 1, line.find_last_of(':'))),
  14.         seconds = stoi(line.substr(line.find_last_of(':') + 1));
  15.  
  16.     long int steps, stepPerSeconds;
  17.     cin >> steps >> stepPerSeconds;
  18.  
  19.     unsigned long int totalSeconds = hours * 3600 + minutes * 60 + seconds + steps * stepPerSeconds;
  20.  
  21.     printf("Time Arrival: %0.2d:%0.2d:%0.2d", totalSeconds / 3600 % 24, totalSeconds % 3600 / 60, totalSeconds % 60);
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement