Sunday, April 30, 2017

URI Solution 1136 Bingo! - Solution in C++ | Ad Hoc

URI Solution 1136 Bingo! - Solution in C++ | Ad Hoc


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

Problem Name: URI Problem Bingo
Problem Number : URI - 1136
Online Judge : URI Online Judge Solution
Level: Ad Hoc
Solution Language : C plus plus

URI Solution 1136 Code in CPP:


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int bolas[1002], marcadas[1002];

int main(int argc, char const *argv[])
{
 int n, b, x, i, j;
 bool p;

 while(scanf("%d %d", &n, &b) && (n || b))
 {
  memset(marcadas, 0, sizeof marcadas);
  p = true;

  for (i = 0; i < b; ++i)
   scanf("%d", &bolas[i]);

  for (i = 0; i < b; ++i)
   for (j = 0; j < b; ++j)
    marcadas[abs(bolas[i] - bolas[j])] = 1;

  for (i = 0; i < (n + 1); ++i)
   if(marcadas[i] == 0)
    p = false;

  printf(p ? "Y\n" : "N\n");
 }

 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.