链接:

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. neo4j 将一个节点的属性复制到另一个节点上

    在使用Python操作Neo4j数据库的时候,经常会遇到重复的节点,需要将一个节点的属性复制到另一个节点,之后将该节点删除. def copy_node_properties(source_node_ ...

  2. 【2019NOIP复习计划】

    (其实不应该这么叫的,应该是CSP-S了现在..) 重点关注的板子: 不知道为什么特别受出题人青睐的LCA(板子点这里) 配套练习:(紫题请自便)  (这题蓝的应该可以试试)  (对的这题也紫它还是道 ...

  3. LC 20 Valid Parentheses

    问题 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the i ...

  4. Python 【函数】

    函数 内置函数print() input() len() type() ... print('Hello World') 函数 参数 定义函数def greet(name): print(name+' ...

  5. Java多线程(十一):线程组

    线程组 线程组可以批量管理线程和线程组对象. 一级关联 例子如下,建立一级关联. public class MyThread43 implements Runnable{ public void ru ...

  6. IOC+EF+Core搭建项目框架(三)

    /// <summary> /// 表示类别映射配置 /// </summary> public partial class sys_UserMap : NopEntityTy ...

  7. C++ STL 之 set 和 pair

    set/multiset 的特性是所有元素会根据元素的值自动进行排序.set 是以 RB-tree(红黑树,平衡二叉树的一种)为底层机制,其查找效率非常好.set 容器中不允许重复元 素,multis ...

  8. # 机器学习算法总结-第五天(降维算法PCA/SVD)

  9. JDBC 插入时间字段的值

    ps.setTimestamp(6, new Timestamp(System.currentTimeMillis()));

  10. 6.移动端自动化测试-小知识 if __name__==’__main__:是什么意思?

    1 引言 在Python当中,如果代码写得规范一些,通常会写上一句“if __name__==’__main__:”作为程序的入口,但似乎没有这么一句代码,程序也能正常运行.这句代码多余吗?原理又在哪 ...