简单题

 /*
 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. 关于BaseAdapter的使用及优化心得(一)

    对于Android程序员来说,BaseAdapter肯定不会陌生,灵活而优雅是BaseAdapter最大的特点.开发者可以通过构造BaseAdapter并搭载到ListView或者GridView这类 ...

  2. iOS网络传输Delegate不被触发的本质原因

    NSURLSession一共有四种Delegate (文后附表有Session和SessionTask分类表格) NSURLSessionDelegate, NSURLSessionDownloadD ...

  3. ngcordova 监控网络制式改变

    ngcordova 监控网络制式改变 keywords cordova,phonegap,ionic,network,网络制式 API参考 http://ngcordova.com/docs/plug ...

  4. JSP页面动态联动

    效果如图: 页面用法: body部分: 注意:控制层Controller中:

  5. offsetParent、offsetTop、offsetLeft、offsetWidth、offsetHeight

    w3c规范,请戳这里:http://www.w3.org/TR/cssom-view/#dom-htmlelement-offsetparent 一.offsetParent 英文解读: part o ...

  6. 重启nginx后丢失nginx.pid解决

    /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

  7. Configuration Management小结

    一.git branch和patch区别 patch,只是把diff部分创建一个分支.Detail: http://www.cnblogs.com/y041039/articles/2411600.h ...

  8. 9 I/O复用

    I/O复用使得程序能够同时监听多个文件描述符,适用于以下情况: 客户端同时处理多个socket,比如非阻塞connect 客户端同时处理用户输入和网络连接,比如聊天室程序 TCP服务器同时处理监听so ...

  9. HDOJ1050

    Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  10. JavaScript 语言基础知识点总结(思维导图)

    JavaScript 数组 JavaScript 函数基础 Javascript 运算符 JavaScript 流程控制 JavaScript 正则表达式 JavaScript 字符串函数 JavaS ...