#include <stdio.h>
#include
#include

using namespace std;

int main()
{
vector i{ 1,2,88,42,99 };

for (auto a = i.begin(); a!= i.end() ; a++)
{
	if (*a == 42)
		break;
	cout << " no :" << *a << endl;
}
return 0;

}

  • created

    Feb '18
  • last reply

    Feb '18
  • 1

    reply

  • 722

    views

  • 2

    users

vector i{ 1,2,88,42,99 };

You’re misunderstanding how Spoj works. You need to read the number from the input, not hard-code them in the source code. The numbers given in the question are just a sample, an example, the real ones used in the actual test cases will be different, and you won’t know what they are.

And you shouldn’t be writing " no :" either.

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 24 15d

Want to read more? Browse other topics in C and C++ or view latest topics.