Wednesday, May 24, 2017

uva problem solution 11839 - Optical Reader



problem link :


Discuss: This is just easy problem to solve.Check the number if it is less then 127 and it's number of one then just print that number.


try yourself before see the code;



#include<bits/stdc++.h>
using namespace std;
int main()
{
   int i,j,n,k,cnt,a;
   vector<int>vec;
   while(cin >>n)
   {

      if(n==0)
      break;
      for(i=0;i<n;i++)
      {
         cnt=0;
         for(j=0;j<5;j++)
         {
         cin >>a;
         if(a<=127)
         {
             k=j;
             cnt++;
         }

         }
         if(cnt==1)
             printf("%c\n",'A'+k);
         else
         cout <<'*'<<endl;


      }

   }

   return 0;

}

No comments:

Post a Comment