Tuesday, May 2, 2017

UVA Solution 1471 Dangerous Dive - Solution in C++ | Ad Hoc

UVA Solution 1471 Dangerous Dive - Solution in C++ | Ad Hoc


URI Online Judge Solution 1471 Dangerous Dive | Ad Hoc
URI Main Problem Link - 1471 Dangerous Dive https://www.urionlinejudge.com.br/judge/en/problems/view/1471

Problem Name: URI Problem 1471 Dangerous Dive
Problem Number : URI Problem 1471 Dangerous Dive Solution
Online Judge : URI Online Judge Solution
Level: Ad Hoc
Solution Language : C plus plus

URI Solution 1471 Dangerous Dive Code in CPP:


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
 int n, r, x;
 bool ver;

 while(cin >> n >> r)
 {
  vector<int> v(n + 1);
  ver = false;

  for (int i = 0; i < r; ++i)
  {
   cin >> x;
   v[x] = 1;
  }

  for (int i = 1; i <= n; ++i)
  {
   if(v[i] == 0){
    ver = true;
    cout << i << " ";
   }
  }

  if(ver == false)
   cout << '*'; 

  cout << endl;
 }

 return 0;
}

No comments:
Write comments

To know more about the problem, give us your valuable commment. We'll try to help you. Thanks

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.