How mang N
答案:1 悬赏:10 手机版
解决时间 2021-11-11 05:57
- 提问者网友:棒棒糖
- 2021-11-10 16:08
How mang N
最佳答案
- 五星知识达人网友:十鸦
- 2021-11-10 17:29
哪来的题目,描述真是破绽百出。
#include
int main( )
{
int n, m, t, f[ 10000 ], i, count;
while ( scanf("%d%d", &n, &m) == 2 )
{
count = t = 0;
for ( i = 0; i < m; i++ )
f[ i ] = 0;
while ( !f[ t ] )
{
count++;
f[ t ] = 1;
t = ( t * 10 + n ) % m;
}
if ( !t )
printf("%d\n", count);
else
printf("0\n");
}
return 0;
}
#include
int main( )
{
int n, m, t, f[ 10000 ], i, count;
while ( scanf("%d%d", &n, &m) == 2 )
{
count = t = 0;
for ( i = 0; i < m; i++ )
f[ i ] = 0;
while ( !f[ t ] )
{
count++;
f[ t ] = 1;
t = ( t * 10 + n ) % m;
}
if ( !t )
printf("%d\n", count);
else
printf("0\n");
}
return 0;
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯