USACO Section 2.2: Runaround Numbers
简单题
/*
ID: yingzho1
LANG: C++
TASK: runround
*/
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <stdio.h>
#include <queue>
#include <cstring>
using namespace std;
ifstream fin("runround.in");
ofstream fout("runround.out");
int N;
int weishu(int n) {
;
while (n) {
n /= ;
ret++;
}
return ret;
}
bool isRunAround(int n) {
int acount = weishu(n);
vector<bool> visit(acount);
string s;
while (n) {
== ) return false;
s += ;
n /= ;
}
reverse(s.begin(), s.end());
;
int len = s.size();
; i < acount; i++) {
cur = (cur + ')) % len;
if (visit[cur]) return false;
visit[cur] = true;
}
return true;
}
bool isUnique(int n) {
set<int> S;
while (n) {
)) return false;
S.insert(n % );
n /= ;
}
return true;
}
int main()
{
fin >> N;
;
) {
if (isUnique(M) && isRunAround(M)) break;
M++;
}
fout << M << endl;
;
}
USACO Section 2.2: Runaround Numbers的更多相关文章
- 【USACO 2.2】Runaround Numbers
找出第一个大于n的数满足:每一位上的数都不同,且没有0,第一位开始每次前进当前这位上的数那么多位,超过总位数就回到开头继续往前进,最后能不能每个位都到过一次且回到第一位,$n<10^9$. 暴力 ...
- USACO 2.2 Runaround Numbers
Runaround Numbers Runaround numbers are integers with unique digits, none of which is zero (e.g., 81 ...
- 洛谷P1467 循环数 Runaround Numbers
P1467 循环数 Runaround Numbers 89通过 233提交 题目提供者该用户不存在 标签USACO 难度普及/提高- 提交 讨论 题解 最新讨论 暂时没有讨论 题目描述 循环数是 ...
- USACO Section 2.2 循环数 Runaround Numbers
OJ:http://www.luogu.org/problem/show?pid=1467 #include<iostream> #include<vector> #inclu ...
- USACO Runaround Numbers 模拟
根据题意的 Runaround 规则去找比当前数大的最近的一个 Runaround数字 模拟题~ Source code: /* ID: wushuai2 PROG: runround LANG: C ...
- USACO Section2.2 Runaround Numbers 解题报告 【icedream61】
runround解题报告---------------------------------------------------------------------------------------- ...
- USACO Runaround Numbers
题目大意:问最近的比n大的循环数是多少 思路:第n遍暴力大法好 /*{ ID:a4298442 PROB:runround LANG:C++ } */ #include<iostream> ...
- USACO Section 1.3 题解 (洛谷OJ P1209 P1444 P3650 P2693)
usaco ch1.4 sort(d , d + c, [](int a, int b) -> bool { return a > b; }); 生成与过滤 generator&& ...
- USACO Section 3.3: Riding the Fences
典型的找欧拉路径的题.先贴下USACO上找欧拉路径的法子: Pick a starting node and recurse on that node. At each step: If the no ...
随机推荐
- 【Reorder List】cpp
题目: Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do ...
- vi中正则表达式的使用
在当前行中删除从aa到zz的所有字符 :s/aa.*zz//在整个文件用and代替所有的&字符:1,$s/&/and/g在每一行的首行插入字符串new:1,$s/^/new/g在第二行 ...
- jekyll : 使用github托管你的博客
使用github托管你的博客 效果: http://wuya1234.github.io/blog/2013/11/09/start-github-blog/ 样式神马的还没整 电脑系统 我使用的是m ...
- Shiro workshop
吃掉<Shiro教程>的精要部分,Go ahead!
- java中的匿名内部类
匿名内部类在java编码中不是很常见,它可一让类实现多继承的特性(多个父类~1个子类) java中的匿名内部类总结http://www.cnblogs.com/nerxious/archive/201 ...
- WCF服务中,[DataMember]属性标记的属性一定要有set访问器
WCF服务中,如果实体类中,包含有[DataMember]属性标记时,该属性一定要有set访问器.当系统必须调用到[DataMember]标记的属性时,如果该属性没有set访问器,则会出错.
- POJ 1700 Crossing River (贪心)
Crossing River Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9585 Accepted: 3622 Descri ...
- 导出含有图片的项目成jar文件后运行,图片不显示
在编写完Java程序后,打包成Jar时发布,会发现找不到Jar文件中的图片和文本文件,其原因是程序中载入图片或文本文件时,使用了以当前工作路径为基准的方式来指定文件和路径.这与用户运行Jar包时的当前 ...
- IDEA开发spark本地运行
1.建立spakTesk项目,建立scala对象Test 2.Tesk对象的代码如下 package sparkTest /** * Created by jiahong on 15-8-2. */ ...
- Apache POI 解析 microsoft word 图片文字都不放过
http://blog.csdn.net/njchenyi/article/details/6894500 http://haohaoxuexi.iteye.com/blog/2031335