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 ...
随机推荐
- JS利用async、await处理少见的登录业务逻辑
在用uniapp开发一个项目时,有这样一个需求:用户首次登录后,uniapp自动保存用户名密码,之后不管是再次打开项目(打开项目时登录状态已失效)还是 请求接口(接口返回登录失效)时,都会先自动默认的 ...
- if (strAreaCode.Find("体检")>=0)
string类提供了6种查找函数,每种函数以不同形式的find命名. 这些操作全部返回string::size_type类型的值,以下形式标记查找匹配所发生的位置: 或者返回一个名为string::n ...
- 剑指offer47:位运算+递归。求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。
1 题目描述 求1+2+3+...+n,要求不能使用乘除法.for.while.if.else.switch.case等关键字及条件判断语句(A?B:C). 2 思路和方法 (1)递归,不能使用if等 ...
- PHP后台开发小经验
js页面传参数 js的参数传输是关键,尤其是当一个页面的数据需要分步骤上传时. 同样的删除功能,不会操作批量删除时可以尝试单个删除,功能差不多,实现功能的方法也千千万,先做成它是第一位. 主页面很多条 ...
- Thinkphp5+Layui上传图片
ThinkPHP是一个免费开源的,快速.简单的面向对象的轻量级PHP开发框架,是为了敏捷WEB应用开发和简化企业应用开发而诞生的.ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能 ...
- logstash grok
input { file { path => "/opt/service/test-service/logs/catalina-error*.log" type => ...
- Android Monkey压测命令
测试步骤:1.安装ADB2.连接被测手机和电脑3.打开CMD命令行4.输入monkey命令adb shell monkey -p your.package.name --pct-touch 30 -- ...
- Python运算符和编码
Python运算符和编码 一.格式化输出 现在有以下需求,让⽤户输入name, age, job,hobby 然后输出如下所⽰: ----------info of dogfa---------- n ...
- C# 连接 Socks5 代理
public class Socks5ProxyHelp { private Socks5ProxyHelp() { } public static string[] errorMsgs = { &q ...
- c# 粘贴复制
复制 1. 复制 Clipboard.SetText("123456"); Clipboard.SetImage(Image img); Clipboard.SetAudio(Sy ...