OJ-Problems-Source/HDOJ/1393_autoAC.cpp

26 lines
475 B
C++
Raw Normal View History

2016-08-13 23:51:27 +08:00
#include<stdio.h>
int main()
{
int n,m,i,j;
while(scanf("%d%d",&n,&m))
{
if(n==0&&m==0)
break;
for(j=1;;j++)
{
if((n+m*n)%60==0)
{
printf("%d\n",j);
break;
}
n=(n+m*n)%60;
if(j>=1000)
{
printf("Impossible\n");
break;
}
}
}
return 0;
}