简单题

 /*
 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的更多相关文章

  1. 【USACO 2.2】Runaround Numbers

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

  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 Section 2.2 循环数 Runaround Numbers

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

  5. USACO Runaround Numbers 模拟

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

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

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

  7. USACO Runaround Numbers

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

  8. 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&& ...

  9. USACO Section 3.3: Riding the Fences

    典型的找欧拉路径的题.先贴下USACO上找欧拉路径的法子: Pick a starting node and recurse on that node. At each step: If the no ...

随机推荐

  1. android中 回调方法,怎么转变为阻塞执行的方法

    项目中需要用到在wifi这一块,扫描附近wifi,然后一个个遍历所有wifi,并且尝试连接,所以就在这里需要每连接一个wifi进行阻塞,当连接失败的时候才进行尝试下一个连接,当连接成功时则break. ...

  2. 查看python selenium的api

    打开命令行工具,doc中输入: python -m pydoc -p 然后在浏览器中访问http://localhost:4567/,此时应该可以看到python中所有的Modules 按ctrl+f ...

  3. shell编程之重定向

    标准输入,输出和错误---------------------------------文件文件                描述符---------------------------------输 ...

  4. 【BZOJ】【1031】【JSOI2007】字符加密Cipher

    后缀数组 当年感觉好神的题现在好像变水了…… 题意其实有点蛋疼……一开始没看懂<_< 将原串复制一遍接在后面,用后缀数组求一下SA,那么SA<n的就是所找到的那n个字符串,然后把它们 ...

  5. 树分治&树链剖分相关题目讨论

    预备知识 树分治,树链剖分   poj1741 •一棵有n个节点的树,节点之间的边有长度.方方方想知道,有多少个点对距离不超过m 题解 点分治模板题.详见我早上写的http://www.cnblogs ...

  6. C#异常处理策略

    1.如果某些异常,本组件无法处理,不要捕获,但要声明有这个异常.例如SecurityException. 2.如果某些异常,本组件可以处理,捕获并处理它,不再声明此异常.例如DirectoryNotF ...

  7. eclipse安装androidSDK地址,Android SDK Manager简介

    eclipse安装android插件地址:https://dl-ssl.google.com/android/eclipse 这个和安装其他插件方式一样:Help—Install New Softwa ...

  8. HDU 4569 Special equations(数学推论)

    题目 //想不出来,看了解题报告 /* 题意:给你一个最高幂为4的一元多项式,让你求出一个x使其结果模p*p为0. 题解:f(x)%(p*p)=0那么一定有f(x)%p=0,f(x)%p=0那么一定有 ...

  9. POJ 1658

    #include<iostream>//cheng da cai zi using namespace std; int main() { int i; int time; ]; cin& ...

  10. 【蛙蛙推荐】Lucene.net试用

    [蛙蛙推荐]Lucene.net试用   [简介] lucene.net好多人都知道的吧,反正我是最近才好好的看了一下,别笑我拿历史当新闻哦,不太了解Lucence的朋友先听我说两句哦.Lucene的 ...