Page 3 of 3
Re: 416 - LED Test
Posted: Tue Oct 14, 2014 12:24 am
by hhicask
Hi.
Somebody can say me why this example is MISMATCH?
My Output: MATCH
Output Udebug: MISMATCH
I think that the first line could be the number 9(YYYYNYY) and the second line could be the number 8(YYYYYYY)
Thanks in advance and sorry my poor english.
Re: 416 - LED Test
Posted: Tue Oct 14, 2014 8:37 pm
by brianfry713
No segments will ever fail into the ON mode; no burned out segments will recover.
If YYNNNNY is 9(YYYYNYY) then segments c, d, and f are burned out.
If YYNYNYN is 8(YYYYYYY) it's a MISMATCH because segments d and f are now on.
Re: 416 - LED Test
Posted: Wed Oct 15, 2014 4:46 am
by hhicask
: D thanks so much brianfy, now I understood the problem and I got AC

416 - LED Test
Posted: Fri Apr 17, 2015 8:49 am
by b1gm4f14
checked my output with Udebug.....
tried all the possible inputs and outputs....
everything is right although UVA is giving WA....
will u plz check my code?
Code: Select all
#include<bits/stdc++.h>
using namespace std;
int led[]={126,48,109,121,51,91,95,112,127,123};
bool chk[10],flag=false;
int main()
{
int Count=0;
//freopen("arf.txt","r",stdin);
int n,data[12];
char ch,temp = 127;
while(1){
memset(data,0,sizeof(data));
flag=false;
scanf("%d",&n);
if(n<1||n>10)
break;
for( int i=1;i<=n;i++)
{
for(int j=6;j>=0;j--)
{
scanf(" %c",&ch);
if(ch=='Y')
data[i] = data[i]|1<<j;
}
// printf("%d\n",data[i]);
}
for (int i=0;i<=9;i++)
{
if((data[1]&led[i])==data[1])
chk[i] = true;
}
for(int i=0;i<=9&&!flag;i++)
{
temp =0;
if(chk[i])
{
chk[i]=false;
for(int j=1;j<=n;j++)
{
//if(data[j]!=0)
temp = temp |(((127&led[i-j+1]))^data[j]);
if((data[j]&led[i-j+1])==data[j]&&!(data[j] & temp))
{
if(j==n)
flag = true;
continue;
}
else break;
}
}
}
if(flag)
printf("MATCH\n");
else
printf("MISMATCH\n");
}
return 0;
}
Re: 416 - LED Test
Posted: Mon Jul 18, 2016 11:56 am
by metaphysis
The test data on uDebug end with end of line instead of 0, beware of it.