Codeforces Round #589 (Div. 2) A. Distinct Digits
链接:
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的更多相关文章
- 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\) ...
- Codeforces Round #589 (Div. 2)
目录 Contest Info Solutions A. Distinct Digits B. Filling the Grid C. Primes and Multiplication D. Com ...
- Codeforces Round #589 (Div. 2) (e、f没写)
https://codeforces.com/contest/1228/problem/A A. Distinct Digits 超级简单嘻嘻,给你一个l和r然后寻找一个数,这个数要满足的条件是它的每 ...
- 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 ...
- 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 ...
- Codeforces Round 589 (Div. 2) 题解
Is that a kind of fetishism? No, he is objectively a god. 见识了一把 Mcdic 究竟出题有多神. (虽然感觉还是吹过头了) 开了场 Virt ...
- 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 ...
- Codeforces Round #589 (Div. 2) D. Complete Tripartite(染色)
链接: https://codeforces.com/contest/1228/problem/D 题意: You have a simple undirected graph consisting ...
- Codeforces Round #589 (Div. 2) C - Primes and Multiplication(数学, 质数)
链接: https://codeforces.com/contest/1228/problem/C 题意: Let's introduce some definitions that will be ...
随机推荐
- [转帖]XCopy复制文件夹命令及参数详解以及xcopy拷贝目录并排除特定文件
XCopy复制文件夹命令及参数详解以及xcopy拷贝目录并排除特定文件 https://www.cnblogs.com/smartsmile/p/7665979.html xcopy dirA dir ...
- [转帖]postgresql查看用户连接以及杀死连接的会话
postgresql查看用户连接以及杀死连接的会话 2017年10月11日 15:21:18 DB_su 阅读数 8908更多 分类专栏: postgresql 版权声明:本文为博主原创文章,遵循 ...
- nginx+uwsgi02---django部署(不推荐)
1.文件结构 myweb/ ├── manage.py ├── myweb/ │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi. ...
- 操作MySQL数据进行记录的随意排序
说到排序,想必大家都知道MySQL中的“ORDER BY”这个关键词吧,使用它可以实现查询数据根据某一字段(或多个字段)的值排序,那么如何实现数据的任意排序操作呢? 其实这里我所说的“随意排序”,本质 ...
- Kubernetes---资源控制器
⒈引用 Pod的分类 自助式pod 只要pod退出了,此类型的pod不会被重建,该pod没有管理者,死亡后不会被拉起. 控制器管理的pod[生产环境中大多数都是选择控制器去管理pod] 在控制器的生命 ...
- hdu 1024 最大m段不相交线段和
题目传送门//res tp hdu 数据范围1e6,若是开二维会爆 考虑用滚动数组优化 #include<iostream> #include<cstdio> #include ...
- # 滚动Hash
滚动Hash 假设字符串\(C=c_1*c_2*...c_m\),定义Hash函数\(H(C)=(C_1*b^{m-1}+C_2*b^{m-2}+...C_m*b^{0})mod\; h\) 从k开始 ...
- Docker的安装和学习
dockers学习 2019年2月23日开始 docker系统要求 centos 7 核心为3.1以上 centos6.5以上 核心为 2.6以上 ...
- MySQL_Utilities工具
需求 Python 2.6 MySQL Connector/Python 连接器 下载地址: http://dev.mysql.com/downloads/utilities/ ...
- 简单分析synchronized不会锁泄漏的原因
最近看到一句话:内部锁synchronized不会造成锁泄漏(Lock Leak). 锁泄漏是指一个线程获得某个锁以后,由于程序的错误.缺陷致使该锁一直没法被释放而导致其他线程一直无法获得该锁的现象. ...