FZU 1062 洗牌问题

时间:2023-03-08 19:08:04
FZU 1062 洗牌问题

首先有一个规律:当一个数字归位的时候,所有数字都会归位。

因此只需要模拟一个数字就可以了。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; int n; int main()
{
while (~scanf("%d", &n))
{
int ans = ;
int now = ; while ()
{
if (now <= n) now = now * ;
else now = * (now - n) - ;
ans++;
if (now == ) break;
} printf("%d\n", ans);
}
return ;
}