Monday, May 1, 2017

URI Solution 1329 Head or Tail - Soluiton in C++ | Ad Hoc

URI Solution 1329 Head or Tail - Solution in C++ | Ad Hoc



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

Problem Name: URI Problem 1329 Head or Tail
Problem Number : URI Problem 1329 Solution
Online Judge : URI Online Judge Solution
Level: Ad Hoc
Solution Language : C plus plus

URI Solution 1329 Code in CPP:

#include <iostream>
using namespace std;

int main()
{
 int n, x;
 int mary = 0, john = 0;

 cin >> n;

 while(n != 0)
 {
  mary = 0;
  john = 0;
  for (int i = 0; i < n; ++i)
  {
   cin >> x;
   if(x == 0){
    mary++;
   }else{
    john++;
   }
  }

  cout << "Mary won " << mary << " times and John won " << john << " times" << endl;

  cin >> 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.