简单题

 /*
 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. Entity Framework技术导游系列开篇与热身

    在微软平台写程序有年头了,随着微软数据存取技术的持续演化,我在程序中先后使用过ODBC.DAO.ADO.ADO.NET.LINQ to SQL. Entity Framework这些技术. 近几年来, ...

  2. Grails 1.2参考文档速读(10):Controller

    转载:http://keyvalue.blog.51cto.com/1475446/303260       从本篇起,我们将开始进入Grails的Web层,首先让我们从Controller说起. G ...

  3. Java 7 中 NIO.2 的使用——第一节 Path 类的使用

    路径隶属于文件系统,实际上它是存储和组织媒体文件的格式,通常在一块或多块硬盘设备上,以便于非常容易地检索.文件系统可以通过  java.nio.file.FileSystems 这个final 类来访 ...

  4. 【数据结构】通用的最小堆(最大堆)D-ary Heap

    听说有一种最小(大)堆,不限于是完全二叉树,而是完全D叉树,名为D-ary Heap(http://en.wikipedia.org/wiki/D-ary_heap).D可以是1,2,3,4,100, ...

  5. git学习,什么是git?

    什么是 Git? 百度百科显示,Git是 Linux 之父 Linus Trovalds,为管理 Linux 内核代码而建立的,被认为是分布式版本控制工具中的顶级水准.智能.友好.强健.高效. 正如所 ...

  6. css中的border还可以这样玩

    在看这篇文章之前你可能会觉得border只是简单的绘制边框,看了这篇文章,我相信你也会跟我一样说一句"我靠,原来css中的border还可以这样玩".这篇文章主要是很早以前看了别人 ...

  7. W3C和IE中的事件处理函数

    在上一篇文章中提到了关于传统的JS中注册事件对象的一些缺点和问题,下面是关于DOM2级的现代事件绑定.本文中设计到的HTML文件在文章最后 一.W3C事件处理函数 “DOM2 级事件”定义了两个方法, ...

  8. vertical sync

    these days, I am compelting vertical sync https://msdn.microsoft.com/zh-cn/library/windows/desktop/b ...

  9. Nsdate的各种常用操作

    // //  NVDate.h // //  Created by Noval Agung Prayogo on 2/5/14. //  Copyright (c) 2014 Noval Agung ...

  10. Topcoder 多校T-shirt场

    盗用名字:C题题目都没看懂, B:You are given a long long n. Return the largest divisor of n that is a perfect squa ...