Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,m,a,x,k,b;
- cin>>n;
- x=20;
- m=4;
- b=0;
- k=x+10;
- cin>>a;
- x+=a;
- m-=1;
- n-=1;
- while(n>0)
- {
- if(x>=k)
- {
- m=4;
- k=x+10;
- }
- if(m==0)
- {
- b=0;
- break;
- }
- if(x<1)
- {
- cout<<"Safety"<<endl;
- b=1;
- break;
- }
- if(x>=100)
- {
- cout<<"Touchdown"<<endl;
- b=1;
- break;
- }
- cin>>a;
- x+=a;
- m-=1;
- n-=1;
- }
- if(x==100 && b==0)
- {
- cout<<"Touchdown"<<endl;
- b=1;
- }
- if(x<1 && b==0)
- {
- cout<<"Safety"<<endl;
- b=1;
- }
- if(b==0)
- {
- cout<<"Nothing"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment