## 11650 - Mirror Clock

Moderator: Board moderators

sanjoy_sust
New poster
Posts: 2
Joined: Wed Jul 22, 2009 9:10 pm

### 11650-why i get WA

#include<stdio.h>
#include<math.h>

int main()
{
int i,j,k,l,mn,hor,n,H,M,m;
while(scanf("%d",&n)>0)
{
for(i=0;i<n;i++)
{
scanf("%d:%d",&H,&M);
if(H<12)
{
mn=60-M;

if(mn>0)
hor=12-1-H;

if(mn==0)
hor=12-H;

}
if(H==12)
{
mn=60-M;
if(mn==0)
hor=H;
if(mn>0)
hor=H-1;
}
if(hor==0)
hor=12;

if(mn==60)
{
hor+=1;
if(hor<=9)
printf("0%d:00\n",hor);
if(hor>9)
printf("%d:00\n",hor);

}

if(mn<60)
{

if(hor>9)
{
if(mn>9)
printf("%d:%d\n",hor,mn);
if(mn<=9)
printf("%d:0%d\n",hor,mn);
}
if(hor<=9)
{
if(mn>9)
printf("0%d:%d\n",hor,mn);
if(mn<=9)
printf("0%d:0%d\n",hor,mn);
}
}
}
}
}
i manage this case bt not right
Last edited by sanjoy_sust on Mon Oct 05, 2009 5:12 pm, edited 1 time in total.

saiful_sust
Learning poster
Posts: 97
Joined: Fri Aug 22, 2008 10:18 pm
Location: CSE.SUST.SYLHET

### Re: 11650-why i get WA

Try this case...........
INPUT:

Code: Select all

``````1
02:00
``````
OUTPUT:

Code: Select all

``````10:00
``````
• IMPOSSIBLE MEANS I M POSSIBLE

meghla
New poster
Posts: 3
Joined: Sat Dec 26, 2009 4:29 pm

### Re: 11650-why i get WA

meghla:ju-cse
my code just fullfill ar the set of ans; still i am getting WA;
can u give me some set why my code is not working?
my sample input and output is;
12
12:0
12:00
12:30
11:30
12:60
11:00
1:59
10:01
2:00
10:00
08:45
03:15
8:45
03:15
11:00
01:00
04:35
07:25
4:35
07:25
7:56
04:04

can u give my any hint why i am getting WA...............!!

iceb3rg
New poster
Posts: 7
Joined: Mon Jul 13, 2009 11:30 am
Location: SUST - CSE
Contact:

### I've tried almost all d cases

Hi, I have tried the possible 780 test cases and checked it with UVA toolkit.
My test cases were from:

00:00 > 12:59 (780 in total)

Unfortunately all the cases has matched with UVA toolkit but I am yet to get "Accepted" ....

here's my code....help me out soon

===========================================================================================================================
#include <stdio.h>

int main()
{
//freopen("out.txt","r",stdin);

int h,m;
int t,i;

double hours,mins,total;
int hrs,mns;
scanf ("%d",&i);

for (t=0;t<i;t++)
{
scanf ("%d:%d",&h,&m);

if (h==12)
h=0;

hours=h*60;

total=hours+m;

total=720-total;
hours=total/60;

//printf ("%lf ",hours);

hours=(int)hours;
//printf ("%lf ",hours);

mins=(total/60)-hours;
mins=mins*60;
//printf ("%lf ",mins);

hrs=hours;
mns=mins;

if (hrs==0)
printf ("12:");

else if (hrs<10)
printf ("0%d:",hrs);
else
printf ("%d:",hrs);

if (mns<10)
printf ("0%d\n",mns);
else
printf ("%d\n",mns);

}
return 0;
}

========================================================================================================================================
still a lot to learn & a long long way to go....but I'll keep trying till I have lov 4 it

rakibz
New poster
Posts: 1
Joined: Tue Aug 23, 2011 7:25 pm

### Re: 11650-why i get WA

Although i think i got all the right output getting WA constently........ can any1 help???

Code: Select all

``````#include<cstdio>
#include<iostream>
#include<cmath>
#include <cstdlib>
using namespace std;
int main()
{
int hr,min,n,i,mh,mm;
while(scanf("%d",&n)==1)
{
while(n--)
{
scanf("%2d:%2d",&hr,&min);
if(min>0)
mh=abs(12-hr-1);
else
mh=abs(12-hr);
mm=60-min;
if(mh==0)
mh=12;
if(mm==60)
mm=0;
if(mm<=9 && mh<=9)
printf("0%d:0%d\n",mh,mm);
else if(mh<=9)
printf("0%d:%d\n",mh,mm);
else if(mm<=9)
printf("%d:0%d\n",mh,mm);
else
printf("%d:%d\n",mh,mm);
}
}

return 0;
}

``````

alimbubt
New poster
Posts: 39
Joined: Tue Aug 07, 2012 10:40 pm
Contact:

### Re: 11650-why i get WA

Try these input output... Hope it will help u....
Input:

Code: Select all

``````20
12:00
10:00
11:59
01:59
06:05
06:00
03:01
07:56
12:01
01:01
11:11
12:55
11:10
06:46
09:59
12:11
08:44
10:19
04:01
09:50
``````
Output:

Code: Select all

``````12:00
02:00
12:01
10:01
05:55
06:00
08:59
04:04
11:59
10:59
12:49
11:05
12:50
05:14
02:01
11:49
03:16
01:41
07:59
02:10
``````
Give me six hours to chop down a tree and I will spend the first four sharpening the axe...(BUBT ILLUSION)
http://uhunt.felix-halim.net/id/155497
http://onlyprogramming.wordpress.com/

shikhorroy
New poster
Posts: 27
Joined: Sat Jul 27, 2013 3:52 am

### 11650 - Mirror Clock(WA)

What wrong with my code??? Why am I getting WA?????????? Help me please.......

Code: Select all

``````#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int T, h, m, H, M;
scanf("%d",&T);
while(T--){
scanf("%d:%d",&h,&m);
H = 12 - ((h == 12) ? 0 : h);
M = 60 - ((m == 0) ? 60 : m);
if(m)   H--;
printf("%02d:%02d\n",H,M);
}
return 0;
}
``````

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 11650 - Mirror Clock(WA)

Input:

Code: Select all

``````1
11:55
``````
Correct output:

Code: Select all

``````12:05
``````
Check input and AC output for thousands of problems on uDebug!

shikhorroy
New poster
Posts: 27
Joined: Sat Jul 27, 2013 3:52 am

### Re: 11650 - Mirror Clock(WA)

Thanks...

Anik_77
New poster
Posts: 2
Joined: Sun Dec 29, 2013 10:37 pm

### 11650 - Mirror Clock

# include<stdio.h>
int main()
{
int h,m,h1=11,m1=60,t,i;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d:%d",&h,&m);
if(m==0 && h!=2 && h!=10 &&h!=0)
printf("%02d:%02d\n",h,m);
else if(h==0 && m==0)
printf("%02d:%02d\n",h1+1,m);
else if(h==h1)
printf("%02d:%02d\n",h+1,m1-m);
else if(h1>h && m1>m)
if(m1-m==60)
printf("%02d:%02d\n",h1-h+1,m);
else
printf("%02d:%02d\n",h1-h,m1-m);
else if(h>h1)
printf("%02d:%02d\n",h1-h+12,m1-m);
}
return 0;
}

And the sample Output:

Input Output

12:00 12:00
10:00 02:00
11:59 12:01
01:59 10:01
06:05 05:55
06:00 06:00
03:01 08:59
07:56 04:04
12:01 11:59
01:01 10:59
11:11 12:49
12:55 11:05
11:10 12:50
06:46 05:14
09:59 02:01
12:11 11:49
08:44 03:16
10:19 01:41
04:01 07:59
09:50 02:10
00:00 12:00
00:01 11:59
00:02 11:58

Anik_77
New poster
Posts: 2
Joined: Sun Dec 29, 2013 10:37 pm

### Re: 11650 - Mirror Clock(WA)

input: 13:00
output: -1:00

jokerz
New poster
Posts: 8
Joined: Tue Nov 05, 2013 10:24 am

### Re: 11650 - Mirror Clock(WA)

I am getting WA.I tried above input and my code gives correct output.
So i need some more critical input and output...

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: Problem No: 11650[Mirror Clock] WRONG ANSWER !

Input:

Code: Select all

``````100
09:44
12:30
09:59
08:25
12:49
02:42
02:15
04:13
01:04
10:54
01:24
12:09
04:27
03:10
04:13
03:03
10:36
12:41
08:09
11:46
06:06
03:23
01:10
04:09
04:53
06:48
02:15
12:57
08:32
10:49
09:46
03:27
10:17
03:41
05:16
03:17
05:49
12:20
06:09
07:14
07:32
01:11
09:35
08:15
09:07
11:45
01:41
11:00
07:13
10:17
11:10
12:36
09:06
08:50
10:26
03:01
02:51
04:30
10:13
02:26
12:34
04:59
12:16
06:05
03:33
12:51
08:40
12:26
06:15
10:54
01:14
10:16
11:53
07:16
08:32
11:11
11:46
03:13
11:02
04:32
12:17
10:03
06:34
02:44
08:38
05:15
08:11
05:42
11:17
06:02
03:33
09:31
01:24
07:14
11:47
05:46
06:01
12:53
03:10
06:17
``````
AC output:

Code: Select all

``````02:16
11:30
02:01
03:35
11:11
09:18
09:45
07:47
10:56
01:06
10:36
11:51
07:33
08:50
07:47
08:57
01:24
11:19
03:51
12:14
05:54
08:37
10:50
07:51
07:07
05:12
09:45
11:03
03:28
01:11
02:14
08:33
01:43
08:19
06:44
08:43
06:11
11:40
05:51
04:46
04:28
10:49
02:25
03:45
02:53
12:15
10:19
01:00
04:47
01:43
12:50
11:24
02:54
03:10
01:34
08:59
09:09
07:30
01:47
09:34
11:26
07:01
11:44
05:55
08:27
11:09
03:20
11:34
05:45
01:06
10:46
01:44
12:07
04:44
03:28
12:49
12:14
08:47
12:58
07:28
11:43
01:57
05:26
09:16
03:22
06:45
03:49
06:18
12:43
05:58
08:27
02:29
10:36
04:46
12:13
06:14
05:59
11:07
08:50
05:43
``````
Check input and AC output for thousands of problems on uDebug!

uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

### Re: Problem No: 11650[Mirror Clock] WRONG ANSWER !

brianfry713,

Thanks for the great test cases!
Check input and AC output for over 7,500 problems on uDebug!

uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

### Re: 11650 - Mirror Clock(WA)

brianfry713's shared some super test cases here.

http://acm.uva.es/board/viewtopic.php?f ... 8c#p276546

Be sure to check 'em out!
Check input and AC output for over 7,500 problems on uDebug!