简单题

 /*
 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. Oracle Client Language Problem

    If you execute SP in the Oracle client and got the error like this: oracle.xdo.XDOException:   oracl ...

  2. 【环境】VS2013和MATLAB相互调用混合编程

    Visual Studio和MATLAB混合编程,有两种方法: 1 MATLAB调用C程序: 2 VS调用MATLAB(目前见到的都是VS,其他编译器如codeblocks,或不提供这项功能): 前一 ...

  3. 二分--1043 - Triangle Partitioning

    1043 - Triangle Partitioning PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit:  ...

  4. BZOJ2457 BeiJing2011 双端队列

    [问题描述] Sherry现在碰到了一个棘手的问题,有N个整数需要排序.  Sherry手头能用的工具就是若干个双端队列.        她需要依次处理这N个数,对于每个数,Sherry能做以下两件事 ...

  5. Zend Studio 错误集锦[PHP]

    错误信息:Cannot create linked resource '/.org.eclipse.dltk.core.external.folders/.link6'.  The parent re ...

  6. C语言中inline的用法

    C语言里面的内联函数(inline)与宏定义(#define)探讨 先简明扼要,说下关键: 1.内联函数在可读性方面与函数是相同的,而在编译时是将函数直接嵌入调用程序的主体,省去了调用/返回指令,这样 ...

  7. datepicker,结束时间必须大于开始时间

    $('#js-start-time').datepicker({ dateFormat:'yy-mm-dd', onSelect: function( startDate ) { var $start ...

  8. 将HTMLCollection/NodeList/伪数组转换成数组

    这里把符合以下条件的对象称为伪数组(ArrayLike) 1,具有length属性 2,按索引方式存储数据 3,不具有数组的push,pop等方法 如 1,function内的arguments . ...

  9. JQuery的ajax方法

    1.使用方式: 由于是全局方法,所以调用简单:$.ajax(); 2.可输入参数: 最好是写成一个json形式,个人不建议用链式,那样看上去不太好. 参数名称 类型 描述 dataType strin ...

  10. poj 3469

    Dual Core CPU Time Limit: 15000MS   Memory Limit: 131072K Total Submissions: 18120   Accepted: 7818 ...