You are not logged in. Please login at www.codechef.com to post your questions!

×

need help in beautiful array (problem in beginner section).

Can anyone explain what is wrong with this code? I dont see anything wrong in it. Please help.

include <iostream>

using namespace std;

int main(){ int T; cin>>T; int n; int x=0; int y=0; int a=0;

for(int m=0;m<t;m++){ cin="">>n; int Asshole[n]; for(int k=0;k<n;k++){ cin="">>Asshole[k]; if(Asshole[k]==1){ x++; } if(Asshole[k]==-1){ y++; } if(Asshole[k]!=1&&Asshole[k]!=0&&Asshole[k]!=-1){ a++; } if(a>1|| (y>1&&x==0)||(a>0&&y>0)){ cout<<"no"<<endl; }else{ cout<<"yes"<<endl; }

}

}

return 0; }

asked 04 Oct '18, 18:35

anartist's gravatar image

0★anartist
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×678

question asked: 04 Oct '18, 18:35

question was seen: 45 times

last updated: 04 Oct '18, 18:35