链接:

https://codeforces.com/contest/1228/problem/A

题意:

You have two integers l and r. Find an integer x which satisfies the conditions below:

l≤x≤r.

All digits of x are different.

If there are multiple answers, print any of them.

思路:

水题.

代码:

#include <bits/stdc++.h>
using namespace std; bool Check(int x)
{
int vis[10] = {0};
while (x)
{
if (vis[x%10] == 1)
return false;
vis[x%10] = 1;
x /= 10;
}
return true;
} int main()
{
int l, r;
cin >> l >> r;
for (int i = l;i <= r;i++)
{
if (Check(i))
{
cout << i << endl;
return 0;
}
}
puts("-1"); return 0;
}

Codeforces Round #589 (Div. 2) A. Distinct Digits的更多相关文章

  1. Codeforces Round #589 (Div. 2)-E. Another Filling the Grid-容斥定理

    Codeforces Round #589 (Div. 2)-E. Another Filling the Grid-容斥定理 [Problem Description] 在\(n\times n\) ...

  2. Codeforces Round #589 (Div. 2)

    目录 Contest Info Solutions A. Distinct Digits B. Filling the Grid C. Primes and Multiplication D. Com ...

  3. Codeforces Round #589 (Div. 2) (e、f没写)

    https://codeforces.com/contest/1228/problem/A A. Distinct Digits 超级简单嘻嘻,给你一个l和r然后寻找一个数,这个数要满足的条件是它的每 ...

  4. Codeforces Round #493 (Div. 2)D. Roman Digits 第一道打表找规律题目

    D. Roman Digits time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  5. Codeforces Round #590 (Div. 3) D. Distinct Characters Queries(线段树, 位运算)

    链接: https://codeforces.com/contest/1234/problem/D 题意: You are given a string s consisting of lowerca ...

  6. Codeforces Round 589 (Div. 2) 题解

    Is that a kind of fetishism? No, he is objectively a god. 见识了一把 Mcdic 究竟出题有多神. (虽然感觉还是吹过头了) 开了场 Virt ...

  7. Codeforces Round #589 (Div. 2) E. Another Filling the Grid(DP, 组合数学)

    链接: https://codeforces.com/contest/1228/problem/E 题意: You have n×n square grid and an integer k. Put ...

  8. Codeforces Round #589 (Div. 2) D. Complete Tripartite(染色)

    链接: https://codeforces.com/contest/1228/problem/D 题意: You have a simple undirected graph consisting ...

  9. Codeforces Round #589 (Div. 2) C - Primes and Multiplication(数学, 质数)

    链接: https://codeforces.com/contest/1228/problem/C 题意: Let's introduce some definitions that will be ...

随机推荐

  1. Scala当中parallelize并行化的用法

    [学习笔记] parallelize并行化集合是根据一个已经存在的Scala集合创建的RDD对象.集合的里面的元素将会被拷贝进入新创建出的一个可被并行操作的分布式数据集.例如:val rdd03 = ...

  2. [翻译] 深入浅出Go语言调度器:第一部分 - 系统调度器

    目录 译者序 序 介绍 系统调度器 执行指令 Figure 1 Listing 1 Listing 2 Listing 3 线程状态 任务侧重 上下文切换 少即是多 寻找平衡 缓存行 Figure 2 ...

  3. 【AtCoder】CODE FESTIVAL 2016 qual C

    CODE FESTIVAL 2016 qual C A - CF -- #include <bits/stdc++.h> #define fi first #define se secon ...

  4. java日志框架系列(2):logback框架详解

    1.logback介绍 1.什么是logback Logback 为取代 log4j 而生. Logback 由 log4j 的创立者 Ceki Gülcü设计.以十多年设计工业级记录系统的经验为基础 ...

  5. 如何判断你的windows系统是32位还是64位?

    [学习笔记] 如 何判断你的windows系统是32位还是64位? java -version时,如果没有64就是32位的.eclipse.ini中如果没有64,就是32位的.但是我们的ini文件里面 ...

  6. VNote: 一个舒适的Markdown笔记软件

    Update: 支持macOSYunpan Update 2: 写在VNote半周岁 QQ群(487756074) Markdown标记语言一直是许多程序员的最爱.目前,有许多优秀的Markdown编 ...

  7. 作业10:String类

    一.基本案例 1.new String("helloworld") 与 "helloworld" public static void main(String[ ...

  8. IoC框架介绍

    转载自:http://blog.csdn.net/wanghao72214/article/details/3969594 1 IoC理论的背景    我们都知道,在采用面向对象方法设计的软件系统中, ...

  9. get_object_or_404返回404(400)

    get_object_or_404:第一个参数为queryset,第二个参数必须以关键字的形式传递,否则报错

  10. spark2.0 DataSet操作的一些问题记录

    随着新版本的Spark已经逐渐稳定,最近拟将原有框架升级到spark 2.0.还是比较兴奋的,特别是SQL的速度真的快了许多.. 然而,在其中一个操作时却卡住了.主要是dataframe.map操作, ...