Menu

SPOJ KNJIGE – KNJIGE

January 1, 2017 - SPOJ

Language: C++

#include<iostream>
#include<stdio.h>
#define sf scanf
#define pf printf
using namespace std;
int main()
{
	int n,a[300001],last;
	sf("%d",&n);
	last=n;
	for(int i=1;i<=n;i++)
	{
		sf("%d",&a[i]);
	}
	for(int i=n;i>=1;i--)
	{
		if(a[i]==last)
		last--;
	}
	pf("%dn",last);
return 0;
}

(118)

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VK

Author of this post : Anuj Chauhan

Leave a Reply

Your email address will not be published. Required fields are marked *