链接:

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. (模板)poj2947(高斯消元法解同余方程组)

    题目链接:https://vjudge.net/problem/POJ-2947 题意:转换题意后就是已知m个同余方程,求n个变量. 思路: 值得学习的是这个模板里消元用到lcm的那一块.注意题目输出 ...

  2. 【转帖】PostgreSQL之 使用扩展Extension

    PostgreSQL之 使用扩展Extension https://www.cnblogs.com/lnlvinso/p/11042677.html 挺好的文章.自己之前没有系统学习过 扩展.. 目前 ...

  3. KMP算法最浅显理解——一看就明白

    https://blog.csdn.net/starstar1992/article/details/54913261 说明 KMP算法看懂了觉得特别简单,思路很简单,看不懂之前,查各种资料,看的稀里 ...

  4. Python可修改和不可修改类型变量(mutuable and immutuable)

    通俗的讲,可修改可以理解为可以在数据所在内存地址直接修改,而不可修改则意味着一旦修改便是创建新的数据对象,而不是在原来的对象内存地址修改 1,Mutuable object [sourcecode l ...

  5. xpath定位器

    目录 什么是xpath? xpath的作用 xpath的术语 xpath语法 XPath 轴 XPath 运算符 xpath的优势 什么是xpath? 官方解释:XPath即为XML路径语言(XML ...

  6. 怎样获取当前文档所有的元素节点(即html标签节点)

    方法1. 使用 document.getElementsByTagName("*"); 方法2. 使用document.querySelectorAll("*" ...

  7. 基于C#实现与新大陆扫码枪通信

    随着工业互联的发展,扫码枪在很多场合都有所应用,超市.商场以及一些智能工厂.今天主要讲如何通过C#实现与新大陆扫码枪(OY10)进行通信,对于扫码枪的配置,这里就不多说了,结合说明书就可以实现.这里值 ...

  8. 【Android】二、HelloWorld

    1. 按照该网址写HelloWorld 例子   http://www.runoob.com/android/android-hello-world-example.html 2.点击 make pr ...

  9. LeetCode 腾讯精选50题--求众数

    由于众数是指数组中相同元素的个数超过数组长度的一半,所以有两种思路,一. 先排序,后取排序后的数组的中间位置的值:二. 统计,设定一个变量统计相同元素出现的次数,遍历数组,若与选定的元素相同,统计变量 ...

  10. 0基础学习web技术

    说实话0基础学习前端挺难的,当然也没有是技术是容易学习的 我只是想分享一下我的学习经历: 分为以下几点: 1:学习html和css ,学习完成之后可以模仿各大网站的静态网页 2:学习原生js基础,jq ...