链接:

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. [转帖]centos7上设置中文字符集

    centos7上设置中文字符集 https://www.cnblogs.com/kaishirenshi/p/10528034.html author: headsen  chen date: 201 ...

  2. oracle索引2

    问什么问题? 索引有什么代价?哪些场景下你需要建索引?或者有时候反过来问,哪些场景下不推荐建索引. 建好索引之后,怎么才能最高效地利用索引?或者反过来问,请说出一个无法有效利用已建索引的案例. 索引的 ...

  3. Python【列表 字典 元组】

    列表列表用中括号[ ]把各种数据框起来,每一个数据叫作“元素”.每个元素之间都要用英文逗号隔开各种类型的数据(整数/浮点数/字符串)————————————————————————————从列表提取单 ...

  4. 学习扩展kmp

    参考博客:https://blog.csdn.net/s_999999/article/details/89104957

  5. Spring Boot:上传文件大小超限制如何捕获 MaxUploadSizeExceededException 异常

    Spring Boot 默认上传文件大小限制是 1MB,默认单次请求大小是 10MB,超出大小会跑出 MaxUploadSizeExceededException 异常 spring.servlet. ...

  6. Django ORM相关的一些操作

    一般操作 看专业的官网文档,做专业的程序员! 必知必会13条 <1> all(): 查询所有结果 <2> filter(**kwargs): 它包含了与所给筛选条件相匹配的对象 ...

  7. 记笔记的软件(vnote)

    前面我们已经把我们的 Ubuntu 系统在物理机上运行起来了,也做了一些简单的优化,教了大家怎么使用 Ubuntu 系统自带的应用商店和 apt 安装和卸载软件.接着我们安装了搜狗输入法,现在我们的系 ...

  8. linux下mysql数据导入到redis

    自Redis 2.6以上版本起,Redis支持快速大批量导入数据,即Pipe传输.通过将要导入的命令转换为Resp格式,然后通过MySQL的concat()来整理出最终导入的命令集合,以达到快速导入的 ...

  9. ES6用来判断数值的相关函数

    最近在学习ES6的基础知识,整理了一下ES6用来判断数值的相关函数 Math.sign() =>判断正负数的函数 Math.trunc() =>取整函数 Number.isInteger( ...

  10. 【QT学习笔记】二、信号槽和自定义信号槽

    1. 信号槽 int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton button("Qui ...