Wednesday, May 3, 2017

URI 1486 Solution Biochemical Digital Circuit | Solution in C++ | Ad Hoc

URI 1486 Solution Biochemical Digital Circuit | Solution in C++ | Ad Hoc


URI Online Judge Solution  1486 Solution Biochemical Digital Circuit | Ad Hoc
URI Main Problem Link - 1486 Solution Biochemical Digital Circuit https://www.urionlinejudge.com.br/judge/en/problems/view/1486

Problem Name: URI Problem 1486 Solution Biochemical Digital Circuit
Problem Number : URI Problem 1486 Solution Biochemical Digital Circuit
Online Judge : URI Online Judge Solution
Level: Ad Hoc
Solution Language : C plus plus

URI Solution 1486 Code in CPP:


#include <cstdio>
using namespace std;

int main()
{
 int p, n, c, x, counter, res;

 while(scanf("%i %i %i", &p, &n, &c) && (p || n || c))
 {
  int matriz[n][p];
  counter = 0; res = 0;

  for (int i = 0; i < n; ++i)
  {
   for (int j = 0; j < p; ++j)
   {
    scanf("%i", &x);
    matriz[i][j] = x;
   }
  }

  for (int j = 0; j < p; ++j)
  {
   counter = 0;
   for (int i = 0; i < n; ++i)
   {
    if(matriz[i][j] != 0){
     counter++;
    }else{
     counter = 0;
    }
    
    if(counter == c){
     res++;
    }
   }
   
  }

  printf("%i\n", res);
 }

 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.