#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int comp(const void *a, const void *b);

int main ()
{
    int year;
    int a[4];
    memset(a, 0, sizeof(a));
    scanf("%d", &year);
    bool flag=false;
    int temp;
    int i;
    while(!flag)
    {
        temp=++year;
        //printf("yrar=%d\n", year);
        //printf("-------------------------------------------------------------------------\n");
        //++cnt;
        for(i=0;i<4; ++i)
        {
            a[i]=temp%10;
            temp/=10;
        }
        /*for(i=3; i>=0; --i)
            printf("%d ", a[i]);
        printf("\n");
        printf("-------------------------------------------------------------------------\n");*/
        qsort(a, 4, sizeof(a[0]), comp);
        /*for(i=0; i<4; ++i)
            printf("%d ", a[i]);
        printf("\n");
        printf("-------------------------------------------------------------------------\n");*/
        for(i=0;i<3;++i)
        {
            if(a[i]<a[i+1])
                ;
                //printf("%d<%d;", a[i], a[i+1]);
            else
                break;
            /*{
                printf("\n");
                printf("%d=%d.", a[i], a[i+1]);
                printf("\n");
                break;
            }*/
        }
        //printf("-------------------------------------------------------------------------\n");
        //printf("i=%d.", i);
        //printf("-------------------------------------------------------------------------\n");
        if(i==3)
            flag=true;
    }
    if(flag)
        printf("%d\n", year);
    return 0;
}

int comp(const void*a, const void *b)
{
    return *(int*)a-*(int*)b;
}

  

271A的更多相关文章

  1. 看个人思路吧,清晰的话就简单 CodeForces 271A - Beautiful Year

    It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is ...

  2. HTML CSS 特殊字符表(转载)

    转载地址:http://blog.csdn.net/bluestarf/article/details/40652011 转载原文地址:http://zhengmifan.com/news/noteb ...

  3. html特殊字符

    平时写代码很少用到HTML的特殊字符,最常用的可能是 了,但有时在移动端为了节省时间,可能会用这些字符实现某种特殊效果,现整理如下: 使用方法: 这些字符属于unicode字符集,所以,你的文档需要声 ...

  4. css 中content内容特殊形状

    用到的一些特殊字符和图标html代码<div class="cross"></div>css代码.cross{    width: 20px;    hei ...

  5. html特殊字符 编码css3 content:"我是特殊符号"

    项目中用到的一些特殊字符和图标 html代码 <div class="cross"></div> css代码 .cross{ width: 20px; he ...

  6. html特殊字符的html,js,css写法汇总

    ⇠  箭头类 符号 UNICODE 符号 UNICODE HTML JS CSS HTML JS CSS ⇠ &#8672 \u21E0 \21E0 ⇢ &#8674 \u21E2 \ ...

  7. C#和JavaScript的区别

    Strong and Loose Typing: 强弱比较 // C# var customer = new Customer(); //var is compiler inferred //Java ...

  8. HTML特殊字符大全2

    HTML的特殊字符我们并不常用,但是有的时候却要在页面中用到这些字符,甚至有时候还需要用这些字符来实现某种特殊的视觉效果.现在,国外的设计师Neal Chester整理了一份很全的特殊字符集,我觉得这 ...

  9. css3 content画出各种图形

    原链接:http://www.phpjz.cn/web/201311/1700.html 之前看到一些网站用户content这个词,觉得很奇怪,原来是css3新增的一个样式,发现还挺好用的,特别是用移 ...

随机推荐

  1. BlackHat Arsenal USA 2018 ToolsWatch黑客工具库

    原文链接:https://medium.com/hack-with-github/black-hat-arsenal-usa-2018-the-w0w-lineup-7de9b6d32796 Blac ...

  2. Faster-RCNN 算法解读(转)

    论文:<Faster R-CNN: Towards Real-Time ObjectDetection with Region Proposal Networks> 摘要:算法主要解决两个 ...

  3. Zookeeper客户端介绍

    客户端是开发人员使用Zookeeper的主要的途径,以下内容将对Zookeeper的内部原理进行详细的学习和讲解.ZooKeeper的客户端主要有一下几个核心组件组成: Zookeeper:提供客户端 ...

  4. linux c调用 mysql代码

    代码: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <mysql/ ...

  5. Iterator和ListIterator

    Iterator和ListIterator主要区别有: 一.ListIterator有add()方法,可以向List中添加对象,而Iterator不能. 二.ListIterator和Iterator ...

  6. View - RemoteViews

    设计Android的工程师起名字还是挺规范的,而且一眼就知道是什么意思.RemoteViews,顾名思义,远程的View.Android为了能让进程A显示进程B的View,设计了这么一种View(其实 ...

  7. 【python】装饰器详解推荐

    复杂道理浅中来,见过的解释最清楚的一篇文章: https://blog.csdn.net/xiangxianghehe/article/details/77170585

  8. 【Android Studio】Gradle配置及问题解决

    Error:Failed to open zip file.Gradle's dependency cache may be corrupt (this sometimes occurs after ...

  9. iOS - 跳转到系统设置

    一.跳转到自己应用设置(iOS8以上系统推荐使用) //跳转到自己应用干的设置配置页(如 定位.相机.相册 这些隐私配置) [[UIApplication sharedApplication] ope ...

  10. Thinkpad L440 无线驱动突然无法使用,无法搜索到无线上网

    问题描述: 环境:Thinkpad L440,不知道是什么版本的,找朋友买的,买的时候连系统都没有,自己装的Win7系统,驱动均为官方网站下载安装.电脑在使用过程中一直带着电池,连接电源使用. 问题: ...