agupta90's blog

By agupta90, 10 years ago, In English
  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Are you sure it works on your machine? Because the input format for the problem seems to be different from what you are doing. Check your input.

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

The input is not space separated, so if you want to scan it into an array like you are doing you can use a string

string input;
cin >> input;
for(i=0;i<n;i++)
    a[i] = input[i] - '0';