codeforces水题100道 第十三题 Codeforces Round #166 (Div. 2) A. Beautiful Year (brute force)
题目链接:http://www.codeforces.com/problemset/problem/271/A
题意:给你一个四位数,求比这个数大的最小的满足四个位的数字不同的四位数。
C++代码:
#include <iostream>
#include <algorithm>
using namespace std;
bool chk(int x)
{
int a[];
for (int i = ; i < ; i ++)
{
a[i] = x % ;
x /= ;
}
sort(a, a + );
for (int i = ; i < ; i ++)
if (a[i] == a[i-])
return false;
return true;
}
int get(const int & x)
{
for(int i = x+; ; i ++)
if (chk(i))
return i;
}
int main()
{
int n;
cin >> n;
cout << get(n);
return ;
}
C++
codeforces水题100道 第十三题 Codeforces Round #166 (Div. 2) A. Beautiful Year (brute force)的更多相关文章
- codeforces水题100道 第二十三题 Codeforces Beta Round #77 (Div. 2 Only) A. Football (strings)
题目链接:http://www.codeforces.com/problemset/problem/96/A题意:判断一个0-1字符串中出现的最长的0字串或者1字串的长度是否大于等于7.C++代码: ...
- codeforces水题100道 第十一题 Codeforces Round #143 (Div. 2) A. Team (brute force)
题目链接:http://www.codeforces.com/problemset/problem/231/A题意:问n道题目当中有多少道题目是至少两个人会的.C++代码: #include < ...
- codeforces水题100道 第二十七题 Codeforces Round #172 (Div. 2) A. Word Capitalization (strings)
题目链接:http://www.codeforces.com/problemset/problem/281/A题意:将一个英文字母的首字母变成大写,然后输出.C++代码: #include <c ...
- codeforces水题100道 第二十一题 Codeforces Beta Round #65 (Div. 2) A. Way Too Long Words (strings)
题目链接:http://www.codeforces.com/problemset/problem/71/A题意:将长字符串改成简写格式.C++代码: #include <string> ...
- codeforces水题100道 第二十题 Codeforces Round #191 (Div. 2) A. Flipping Game (brute force)
题目链接:http://www.codeforces.com/problemset/problem/327/A题意:你现在有n张牌,这些派一面是0,另一面是1.编号从1到n,你需要翻转[i,j]区间的 ...
- codeforces水题100道 第十九题 Codeforces Round #109 (Div. 2) A. I_love_%username% (brute force)
题目链接:http://www.codeforces.com/problemset/problem/155/A题意:找到当前最大值或者最小值出现的次数.“当前”的意思差不多是a[i]大于所有a[j]( ...
- codeforces水题100道 第十七题 Codeforces Beta Round #25 (Div. 2 Only) A. IQ test (brute force)
题目链接:http://www.codeforces.com/problemset/problem/25/A题意:在n个书中找到唯一一个奇偶性和其他n-1个数不同的数.C++代码: #include ...
- codeforces水题100道 第十题 Codeforces Round #277 (Div. 2) A. Calculating Function (math)
题目链接:www.codeforces.com/problemset/problem/486/A题意:求表达式f(n)的值.(f(n)的表述见题目)C++代码: #include <iostre ...
- codeforces水题100道 第八题 Codeforces Round #274 (Div. 2) A. Expression (math)
题目链接:http://www.codeforces.com/problemset/problem/479/A题意:给你三个数a,b,c,使用+,*,()使得表达式的值最大.C++代码: #inclu ...
随机推荐
- IDEA中 @override报错的解决方法
今天用IDEA导入一个java工程时,碰上一个问题,代码中所有@override处标红,并提示:@override不支持对接口的实现. 网上百度了一下发现, 原因是引用JDK5版本中存在小bug的问题 ...
- jsp页面利用JS做即时时间显示
想给系统多些点缀,顺便把知识点温习一遍,不过讲真,这些都是网上扒的!我的水平现在也就这样 <%@page import="javax.xml.crypto.Data"%> ...
- discuz X论坛技术架构 MVC结构浅析
摘自:http://yeyuan.iteye.com/blog/930727 PS:本人刚接触discuz论坛,php水平有限,当中的理解,如有不正确之处,欢迎指出 ----------------- ...
- e795. 获得和设置JSlider的值
// To create a slider, see e794 创建JSlider组件 // Get the current value int value = slider.getValue(); ...
- e808. 建立菜单栏,菜单,菜单项
When the user selects a menu item, it fires an action event. // Create the menu bar JMenuBar menuBar ...
- e777. 获得JList组件的所有项
// Create a list String[] items = {"A", "B", "C", "D"}; JLis ...
- 模式识别之bpnn---神经网络训练
http://blog.csdn.net/linj_m/article/details/40679085
- u3d外部资源 打包与加载的问题
被坑了一下午,调bug,u3d外部加载资源一会可以,一会不行,始终找不到问题,最后快下班的时候,重新试了一下,原来是资源打包之前的文件名,和之后的加载资源名必须一样 [MenuItem("C ...
- springboot+shiro+redis(集群redis版)整合教程
相关教程: 1. springboot+shiro整合教程 2. springboot+shiro+redis(单机redis版)整合教程 3.springboot+shiro+redis(单机red ...
- 《Thinking in Java》习题——吸血鬼数字
最近在看<Java编程思想>,这本书非常棒,不愧是Java程序员的圣经.看到第四章,后面有道题目很有意思,于是就自己做了做.