直接搜就行。

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#include <stack>
#define mkp make_pair
using namespace std;
const double EPS=1e-;
typedef long long lon;
const lon SZ=,INF=0x7FFFFFFF; bool chk(int x)
{
set<int> st;
for(;x;)
{
if(st.find(x%)!=st.end())return ;
else st.insert(x%);
if(x%==)return ;
x/=;
}
return ;
} int getdgt(int x)
{
int res=;
for(;x;)
{
x/=;
++res;
}
return res;
} bool work(int x)
{
int dgt=getdgt(x);
int pos=dgt-,src=pos;
set<int> st;
for(;;)
{
if(st.find(pos)!=st.end())
{
if(pos==src&&st.size()==dgt)return ;
else return ;
}
st.insert(pos);
//if(st.size()==dgt)break;
int delta=x/(int)(pow(,pos)+0.5)%;
pos=((pos-delta)%dgt+dgt)%dgt;
}
return ;
} int main()
{
std::ios::sync_with_stdio();
//freopen("d:\\1.txt","r",stdin);
lon casenum;
//cin>>casenum;
//for(lon time=1;time<=casenum;++time)
{
int n;
cin>>n;
for(int i=n+;;++i)
{
if(chk(i))
{
if(work(i))
{
cout<<i<<endl;
break;
}
}
}
}
return ;
}

p1467 Runaround Numbers的更多相关文章

  1. 洛谷P1467 循环数 Runaround Numbers

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

  2. USACO 2.2 Runaround Numbers

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

  3. USACO Runaround Numbers 模拟

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

  4. 【USACO 2.2】Runaround Numbers

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

  5. USACO Section 2.2 循环数 Runaround Numbers

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

  6. USACO Section 2.2: Runaround Numbers

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

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

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

  8. USACO Runaround Numbers

    题目大意:问最近的比n大的循环数是多少 思路:第n遍暴力大法好 /*{ ID:a4298442 PROB:runround LANG:C++ } */ #include<iostream> ...

  9. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

随机推荐

  1. git初学

    git在团队合作开发时是很有用的,SVN是集中式的代表,而git是分布式的代表,它分为代码区.暂存区.和本地库.在同一个团队中开发时,在代码存储中心(例如,码云.github)上创建一个库,用于储存和 ...

  2. Python3基础 response.info 服务器返回的header信息

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  3. Ubuntu 18.04 休眠后无法唤醒的解决办法

    解决办法:安装laptop-mode-tools工具包. 1.检查是否安装了grep laptop-mode-tools 工具包 $ dpkg -l | grep laptop-mode-tools ...

  4. 在fedora23中安装virtualbox, 然后实现虚拟机irtualbox 或者 vmware 下的xp操作系统

    参考: http://blog.csdn.net/statdm/article/details/7756788 参考: http://www.cnblogs.com/fengbohello/p/488 ...

  5. 【学习】Hall’s Marriage Theorem

    其实是在做题时遇到这个定理的. 这个定理的图论意义是: 对于一个二分图\(G=\{X+Y,E\}\),它满足: \(\forall W \subseteq X, \, |W| \leq |N_G(W) ...

  6. (转)Swagger2 & Postman工具使用

    (二期)7.swagger2与postman [课程七]swagge...tman.xmind0.3MB [课程七预习]sw...tman.xmind31.3KB 随着互联网技术的发展,现在的网站架构 ...

  7. Centos 安装R

    1 下载R源代码 原码下载地址https://cloud.r-project.org/https://cloud.r-project.org/src/base/R-3/R-3.4.2.tar.gz 2 ...

  8. 每天一个小程序—0013题(爬图片+正则表达式 or BeautifulSoup)

    第 0013 题: 用 Python 写一个爬图片的程序,爬 这个链接里的日本妹子图片 :-) 关于python3的urllib模块,可以看这篇博客:传送门 首先是用urlopen打开网站并且获取网页 ...

  9. Java转义形如nbsp;的HTML编码

    需要引用一个maven <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --> <d ...

  10. Javascript 垃圾回收机制

    转载于https://www.cnblogs.com/zhwl/p/4664604.html 一.垃圾回收的必要性 由于字符串.对象和数组没有固定大小,所有当他们的大小已知时,才能对他们进行动态的存储 ...