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

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

#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 ;
}

最新文章

  1. Oracle如何实现从特定组合中随机读取值
  2. SQL Server逻辑读、预读和物理读
  3. “mybatis 中使用foreach 传
  4. 【Python自动化运维之路Day4】
  5. 桥牌笔记:Skill 4 Series A–Deal 5
  6. Linux创建用户并赋予Root权限
  7. CentOS Linux下一个tomcat起停,查看日志的shell script
  8. jquery的clone方法bug的修复
  9. HW2.18
  10. Invalid project description overlaps the location of another project [android]
  11. 【转】HttpServlet详解
  12. groovy 弹出菜单
  13. AS3条件编译
  14. JAVA三大特性之一——封装
  15. 【转载】Python中的正则表达式教程
  16. hive之size函数和cast转换函数
  17. Java常用API及Math类
  18. linux防火墙使用以及配置
  19. python输出显示颜色
  20. Java基础-类加载机制与自定义类Java类加载器(ClassLoader)

热门文章

  1. 修改apache配置文件去除thinkphp url中的index.php
  2. Slow HTTP Denial of Service Attack 漏洞解决
  3. WinRAR5.31 注册码
  4. Linux + Apache + PHP 环境搭建
  5. 4D(DRG、DLG、DOM、DEM)数据 概念
  6. 如何用好 Google 搜索引擎?
  7. HDU 3265 Posters ——(线段树+扫描线)
  8. Android Studio的使用(九)--设置IDE编码格式
  9. 关于jdk环境变量配置成了1.6.0_39 32位jdk 的路径 cmd中java -version却还是显示 64位或者其他jdk 路径的解决方法
  10. &lt;a href=&quot;#&quot; onclick=&quot;history.back();&quot;&gt;&lt;/a&gt;这样写为什么是对的? -(转)