Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- int head=3 , tail =3 ;
- int * a= new int [9];
- for (int i=0;i<9;i++){
- cin >> a[i];
- }
- for (int i=0;i<9;i++){
- int x=a[i];
- if( (x!=1 && x!=2 && x!=3 && x!=4) || tail<0 || head<0 ){
- cout<<"invalid attack"<<endl;
- return 0;
- }
- if ( x== 1 ){
- }
- else if ( x==2 ){
- tail++;
- }
- else if (x==4 ){
- head++;
- tail-=2;
- }
- else if ( x==3 ){
- head-=2;
- }
- }
- if ( head <= 0 && tail<=0 )cout<<"You slayed the Dragon.";
- else cout<<"You die.";
- return 0;
- }
Add Comment
Please, Sign In to add comment