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 ...
随机推荐
- Oracle使用——oracle 忘记用户密码登录
背景 有时候我们忘记了oracle登录的用户密码,甚至是用户名称都不确定,应该怎么登陆呢 操作系统 CentOS7 Oracle12c 操作步骤 使用sqlplus登录系统:sqlplus / a ...
- Delphi XE5 for Android (八)
delphi xe5 编译的程序在启动时会有短暂的黑屏出现,这个现象产生是因为启动首个activity时会加载一些初始化数据,整个时间大约在2~3秒,如何处理? 网上有些资料,这里主要参考和整理了CS ...
- checkbox勾选事件,JQ设置css,下拉框JQ选中
<input id="CheckMainCompany" type="checkbox"/> $(function() { $("#Che ...
- hihoCoder week23 最短路径·一
spfa 最短路 #include <bits/stdc++.h> using namespace std; #define pb push_back #define INF 1e16; ...
- oracle 之 定时任务,存储过程和游标等语法案例
--定时任务 declare job20 number; begin sys.dbms_job.submit(job20,'test1;',sysdate,'sysdate+1'); end; --存 ...
- LuoguP5221 Product
题目地址 题目链接 题解 注,下方\((i,j)\)均指\(gcd(i,j)\),以及证明过程有一定的跳步,请确保自己会莫比乌斯反演的基本套路. 介绍本题的\(O(n)\)和\(O(n\sqrt{n} ...
- The issus in Age Progression/Regression by Conditional Adversarial Autoencoder (CAAE)
The issus in Age Progression/Regression by Conditional Adversarial Autoencoder (CAAE) Today I tried ...
- [蓝桥] 基础练习 数列排序(java)
问题描述 给定一个长度为n的数列,将这个数列按从小到大的顺序排列.1<=n<=200 输入格式 第一行为一个整数n. 第二行包含n个整数,为待排序的数,每个整数的绝对值小于10000. 输 ...
- 【译】第8节---EF Code First中配置类
原文:http://www.entityframeworktutorial.net/code-first/configure-classes-in-code-first.aspx 前面的章节中我们知道 ...
- JS实现ul,li排序效果
<!DOCTYPE html> <html> <head> <title>js列表排序</title> <meta charset=& ...