Advertisement
Spocoman

Mountain Run

Sep 20th, 2023
957
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     double record, meters, secondPerMeter;
  8.     cin >> record >> meters >> secondPerMeter;
  9.  
  10.     double score = meters * secondPerMeter + (int)(meters / 50) * 30;
  11.  
  12.     if (score < record) {
  13.         printf("Yes! The new record is %.2f seconds.\n", score);
  14.     }
  15.     else {
  16.         printf("No! He was %.2f seconds slower.\n", score - record);
  17.     }
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement