题目大意:问最近的比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. 【extjs6学习笔记】0.3 准备:系统架构

  2. win7 x64和win10 x64 windbg 本地调试记录

    今天看CSDN和某文档看了win7 64位 和win10 64位 的windbg本地调试内核的办法 win7 x64 Step1:kdbgctrl –db Step2:kdbgctrl –e Step ...

  3. COFF文件格式

    链接器 目录 一 COFF-Common Object File Format-通用对象文件格式... 3 COFF的文件格式与结构体... 4 文件头... 5 numberOfSections(区 ...

  4. ios push Payload

    https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotifi ...

  5. js 判断是什么浏览器、是否为谷歌浏览器

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http ...

  6. 关于highchts X时间轴比设置时间相差好几个小时的解决

    经过一番查询和研究发现,在曲线图里,x轴的UNIX时间戳是要乘以1000的(通过在线的UNIX转换,结果与原来没有乘以1000的时间戳相差甚远),不然显示的时间会有很大的误差,真是百思不得其解. 另外 ...

  7. 美可能排除中国大陆制造/生产的所有5G产品

    https://www.wsj.com/articles/u-s-considers-requiring-5g-equipment-for-domestic-use-be-made-outside-c ...

  8. SSH中的jar包讲解

    我们在搭建SSH框架的时候,需要引入各自的一些jar包 首先,先来看一下我们使用的SSH的各自版本及引入的jar包.   struts2.3.1.2: struts2-core-2.3.1.jar j ...

  9. 函数的参数是函数,函数中Ajax返回的回调函数中的函数运行

    调用函数 checkAjax('addrinfo',formdata,vzxcv); 函数checkAjax function checkAjax(url,formdata,call_back){ / ...

  10. shell脚本,检查给出的字符串是否为回文

    [root@localhost wyb]# .sh #!/bin/bash #检查给出的字符串是否为回文 read -p "Please input a String:" numb ...