FZU 1062 洗牌问题
2024-09-30 05:49:06
首先有一个规律:当一个数字归位的时候,所有数字都会归位。
因此只需要模拟一个数字就可以了。
#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 ;
}
最新文章
- Oracle如何实现从特定组合中随机读取值
- SQL Server逻辑读、预读和物理读
- “mybatis 中使用foreach 传
- 【Python自动化运维之路Day4】
- 桥牌笔记:Skill 4 Series A–Deal 5
- Linux创建用户并赋予Root权限
- CentOS Linux下一个tomcat起停,查看日志的shell script
- jquery的clone方法bug的修复
- HW2.18
- Invalid project description overlaps the location of another project [android]
- 【转】HttpServlet详解
- groovy 弹出菜单
- AS3条件编译
- JAVA三大特性之一——封装
- 【转载】Python中的正则表达式教程
- hive之size函数和cast转换函数
- Java常用API及Math类
- linux防火墙使用以及配置
- python输出显示颜色
- Java基础-类加载机制与自定义类Java类加载器(ClassLoader)
热门文章
- 修改apache配置文件去除thinkphp url中的index.php
- Slow HTTP Denial of Service Attack 漏洞解决
- WinRAR5.31 注册码
- Linux + Apache + PHP 环境搭建
- 4D(DRG、DLG、DOM、DEM)数据 概念
- 如何用好 Google 搜索引擎?
- HDU 3265 Posters ——(线段树+扫描线)
- Android Studio的使用(九)--设置IDE编码格式
- 关于jdk环境变量配置成了1.6.0_39 32位jdk 的路径 cmd中java -version却还是显示 64位或者其他jdk 路径的解决方法
- <;a href=";#"; onclick=";history.back();";>;<;/a>;这样写为什么是对的? -(转)