p1467 Runaround Numbers
直接搜就行。
#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的更多相关文章
- 洛谷P1467 循环数 Runaround Numbers
P1467 循环数 Runaround Numbers 89通过 233提交 题目提供者该用户不存在 标签USACO 难度普及/提高- 提交 讨论 题解 最新讨论 暂时没有讨论 题目描述 循环数是 ...
- USACO 2.2 Runaround Numbers
Runaround Numbers Runaround numbers are integers with unique digits, none of which is zero (e.g., 81 ...
- USACO Runaround Numbers 模拟
根据题意的 Runaround 规则去找比当前数大的最近的一个 Runaround数字 模拟题~ Source code: /* ID: wushuai2 PROG: runround LANG: C ...
- 【USACO 2.2】Runaround Numbers
找出第一个大于n的数满足:每一位上的数都不同,且没有0,第一位开始每次前进当前这位上的数那么多位,超过总位数就回到开头继续往前进,最后能不能每个位都到过一次且回到第一位,$n<10^9$. 暴力 ...
- USACO Section 2.2 循环数 Runaround Numbers
OJ:http://www.luogu.org/problem/show?pid=1467 #include<iostream> #include<vector> #inclu ...
- USACO Section 2.2: Runaround Numbers
简单题 /* ID: yingzho1 LANG: C++ TASK: runround */ #include <iostream> #include <fstream> # ...
- USACO Section2.2 Runaround Numbers 解题报告 【icedream61】
runround解题报告---------------------------------------------------------------------------------------- ...
- USACO Runaround Numbers
题目大意:问最近的比n大的循环数是多少 思路:第n遍暴力大法好 /*{ ID:a4298442 PROB:runround LANG:C++ } */ #include<iostream> ...
- POJ题目细究
acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP: 1011 NTA 简单题 1013 Great Equipment 简单题 102 ...
随机推荐
- 关于python hashlib模块的使用
hashlib hashlib主要提供字符加密功能,将md5和sha模块整合到了一起,支持md5,sha1, sha224, sha256, sha384, sha512等算法 #!/usr/bin/ ...
- CentOS7设置定时任务 每隔30分钟执行一次命令
ref https://blog.csdn.net/xiangxianghehe/article/details/78149094 一.安装 crontabs服务并设置开机自启: yum inst ...
- 浅谈FFT、NTT和MTT
前言 \(\text{FFT}\)(快速傅里叶变换)是 \(O(n\log n)\) 解决多项式乘法的一个算法,\(\text{NTT}\)(快速数论变换)则是在模域下的,而 \(\text{MTT} ...
- UI之ECharts
官网 效果图展示: 特性 ECharts,一个使用 JavaScript 实现的开源可视化库,可以流畅的运行在 PC 和移动设备上,兼容当前绝大部分浏览器(IE8/9/10/11,Chrome,Fir ...
- appium长按按钮
public static AndroidDriver driver; /长按操作:waitAction的参数单位是ms/ public static void longClick(String id ...
- sprinf sprintf_s 的用法
函数功能: 将数据格式化输出到字符串 函数原型: int sprintf( char *buffer, const char *format [,argument] ... ) 注意这里的buffer ...
- MyBatis数据库测试代码自动生成
<!-- generatorConfig.xml配置,其中:<plugin type="org.mybatis.generator.plugins.ToStringPlugin& ...
- _map
地图属性控制表 comment 备注 Map 地图ID,.gps第一个参数 Zone 区域ID,.gps第二个参数,整个地图时填0 Area 地域ID,.gps第三个参数,整个地图或区域时填0 Cha ...
- VirtualBox安装Centos6.8出现——E_INVALIDARG (0x80070057)
VirtualBox使用已有的虚拟硬盘出错: 问题描述:UUID已经存在 Cannot register the hard disk 'E:\system_iso\centos6.8.vdi' {05 ...
- OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000083e80000, 1366294528, 0) failed;
我是在手动搭建nexus时遇到的 安装nexus时 启动命令的时候会报OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000 ...