T3000

Untitled

Nov 19th, 2021
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int t,a,b,m,n;
  10.     double x;
  11.     cin>>t;
  12.     m=3;
  13.     b=0;
  14.     x=20;
  15.     cin>>a;
  16.     t-=1;
  17.  
  18.  
  19.     n=ceil((x+1)/10)*10;
  20.  
  21.     x+=a;
  22.  
  23.  
  24.  
  25.     while(t>=0)
  26.     {
  27.         if(x<n)
  28.         {
  29.             m-=1;
  30.         }
  31.         else
  32.         {
  33.             m=3;
  34.             n=ceil(x/10)*10;
  35.         }
  36.  
  37.         if(m==0)
  38.         {
  39.             b=0;
  40.             break;
  41.         }
  42.         if(x<1)
  43.         {
  44.             cout<<"Safety"<<endl;
  45.             b+=1;
  46.             break;
  47.  
  48.         }
  49.         if(x>=100)
  50.         {
  51.             cout<<"Touchdown"<<endl;
  52.             b+=1;
  53.             break;
  54.  
  55.         }
  56.         t-=1;
  57.         if(t<0){
  58.             break;
  59.         }
  60.         cin>>a;
  61.  
  62.  
  63.         x+=a;
  64.        
  65.  
  66.  
  67.  
  68.     }
  69.  
  70.     if(b==0)
  71.     {
  72.         cout<<"Nothing"<<endl;
  73.  
  74.     }
  75.  
  76.  
  77.  
  78.  
  79.     return 0;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment