T3000

Untitled

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