Views

Saturday, May 7, 2022

Solution Kattis · Santa Klas

Source 






Editorial:
- Satan's train can only hit the ground when the angle v > 180. To calculate the time to hit the ground, we apply the geometry formula of junior high school: 
with h is the number of whole seconds that the ACM have to safely wake Santa Klas up
        b, angle α: Santa Klas’ current altitude and his current angle in degrees from the horizon

Code:

#include<bits/stdc++.h>
#define pi atan(1)*4
using namespace std;

int main(){
   
    int h, a;
    cin >> h >> a;
    cout << (a <= 180 ? "safe" : to_string( (int)floor(h/cos(abs(270-a)*pi/180)) ));
                       
}









No comments: