题目大意:问最近的比n大的循环数是多少

思路:第n遍暴力大法好

 /*{
ID:a4298442
PROB:runround
LANG:C++
}
*/
#include<iostream>
#include<fstream>
#define maxn 500
using namespace std;
ifstream fin("runround.in");
ofstream fout("runround.out");
//#define fin cin
//#define fout cout
int runround(long long x)
{
int digital[maxn]={},num[maxn],h=;
bool visit[maxn]={},visit2[]={};
while(x!=)
{
digital[++h]=x%;
if(visit2[digital[h]]==)return ;
visit2[digital[h]]=;
if(digital[h]==)return ;
x/=;
}
for(int i=h;i>=;i--)num[i-]=digital[h-i+];
int pos=;
for(int i=;i<=h;i++)
{
visit[pos]=;
int u=num[pos];
pos=(u+pos)%h;
if(visit[pos]== && i!=h)return ;
if(i==h && pos!=)return ;
}
return ;
}
int main()
{
int n;
fin>>n;
for(long long i=n+;;i++)
{
if(runround(i))
{
fout<<i<<endl;
break;
}
}
return ;
}

USACO Runaround Numbers的更多相关文章

  1. USACO Runaround Numbers 模拟

    根据题意的 Runaround 规则去找比当前数大的最近的一个 Runaround数字 模拟题~ Source code: /* ID: wushuai2 PROG: runround LANG: C ...

  2. USACO 2.2 Runaround Numbers

    Runaround Numbers Runaround numbers are integers with unique digits, none of which is zero (e.g., 81 ...

  3. 洛谷P1467 循环数 Runaround Numbers

    P1467 循环数 Runaround Numbers 89通过 233提交 题目提供者该用户不存在 标签USACO 难度普及/提高- 提交  讨论  题解 最新讨论 暂时没有讨论 题目描述 循环数是 ...

  4. USACO Humble Numbers

    USACO  Humble Numbers 这题主要是两种做法,第一种是比较常(jian)规(dan)的-------------用pq(priority_queue)维护,每次取堆中最小值(小根堆) ...

  5. 【USACO 2.2】Runaround Numbers

    找出第一个大于n的数满足:每一位上的数都不同,且没有0,第一位开始每次前进当前这位上的数那么多位,超过总位数就回到开头继续往前进,最后能不能每个位都到过一次且回到第一位,$n<10^9$. 暴力 ...

  6. USACO Section 2.2 循环数 Runaround Numbers

    OJ:http://www.luogu.org/problem/show?pid=1467 #include<iostream> #include<vector> #inclu ...

  7. USACO Section 2.2: Runaround Numbers

    简单题 /* ID: yingzho1 LANG: C++ TASK: runround */ #include <iostream> #include <fstream> # ...

  8. USACO Section2.2 Runaround Numbers 解题报告 【icedream61】

    runround解题报告---------------------------------------------------------------------------------------- ...

  9. p1467 Runaround Numbers

    直接搜就行. #include <iostream> #include <cstdio> #include <cmath> #include <algorit ...

随机推荐

  1. Mysql常用的优化技巧

    1.通过show status 命令了解各种sql的执行效率 2. 定位执行效率较低的SQL语句 开启慢查询记录: 打开Mysql配置文件my.ini ,找到 [mysqld] 在其下面添加 long ...

  2. Windows Server 2008 R2中上传和下载文件

    在 Windows Server 2008 R2 中,使用服务器管理器来启用或禁用 Windows 功能,那在这个上面如何上传和下载文件呢? 1.在“服务器管理器”->“角色”->“web ...

  3. codevs 1145 Hanoi双塔问题 2007年NOIP全国联赛普及组

    时间限制: 1 s  空间限制: 128000 KB  题目等级 : 黄金 Gold 题目描述 Description 给定A.B.C三根足够长的细柱,在A柱上放有2n个中间有孔的圆盘,共有n个不同的 ...

  4. ubuntu 14.04 离线部署docker

    hett@hett-virtual-machine:~$ lsb_release -aNo LSB modules are available.Distributor ID:    UbuntuDes ...

  5. Tunneling cannot be enabled without the local_ip bound to an interface on the host. Please configure local_ip 192.168.30.71 on the host interface to be used for tunneling and restart the agen

    按照官方文档配置linux bridge 会出现一下问题 Tunneling cannot be enabled without the local_ip bound to an interface ...

  6. build.sbt的定义格式

    一个简单的build.sbt文件内容如下: name := "hello" // 项目名称 organization := "xxx.xxx.xxx" // 组 ...

  7. webStorm Ctrl+s 自动格式化 然后 保存 用宏命令

    使用WebStorm的Macros宏指令,实现保存的同时格式化代码,并跳至行尾 https://blog.csdn.net/gyz718/article/details/70556188

  8. python 基础之运算符

    运算符 a=10 ,b=20 运算符 描述 实例 + 加 - 两个对象相加 a + b 输出结果 30 - 减 - 得到负数或是一个数减去另一个数 a - b 输出结果 -10 * 乘 - 两个数相乘 ...

  9. 46.Maximum Product Subarray(最大乘积子数组)

    Level:   Medium 题目描述: Given an integer array nums, find the contiguous subarray within an array (con ...

  10. 【C语言项目】贪吃蛇游戏(下)

    目录 00. 目录 07. 游戏逻辑 7.5 按下ESC键结束游戏 7.6 判断是否撞到墙 7.7 判断是否咬到自己 08. 游戏失败界面设计 8.1 游戏失败界面边框设计 8.2 撞墙失败界面 8. ...