we are organising a contest of 2 and half hours on 15th june at 9:00 pm ist to 11:30 pm ist on hackerrank.
ohh I was late to read this post…
I have a doubt from your contest in Tricky Eyes
for test case
240 36 you gave null output… that means according to you there is no answer possible…
#while if we keep clock at +36 then…
at 9:12
#angle of minute hand would be (72-36)= 36
and
#angel of hour hand would be (270+(12/2)-36)=240
1 Like
i.e. in your test case #3
formulas I used were from
for finding angle of hour and min hand…
Yeah!!..I also have the same doubt.
1 Like
#include <bits/stdc++.h>
using namespace std;
int main() {
int h,m,i,j,a,b;
bool flag=false;
cin >> h >> m;
for(i=0;i<12;i++){
for(j=0;j<60;j+=2){
a=6*j;
b=(30*i)+j/2;
if(((a-m)%360+360)%360==((b-h)%360+360)%360){
flag=true;
break;
}
}
if(flag)
break;
}
if(flag){
cout << setfill('0') << setw(2) << i ;
cout << ":";
cout << setfill('0') << setw(2) << j ;
}
else
cout << "";
return 0;
}
Here is a solution passing all of your test cases except 3rd one…
please do inform us earlier… I found your questions interesting to solve but couldn’t participate… (cuz they are easy from our div1 :D)
At least inform one or two days early…
just solved each questions… all accepted