#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. SQL2008R2的 遍历所有表更新统计信息 和 索引重建

    [2.以下是更新统计信息] DECLARE UpdateStatisticsTables CURSOR READ_ONLY FOR SELECT sst.name, Schema_name(sst.s ...

  2. [MySQL TroubleShooting] 服务启动报错

    有个朋友发了一段启动错误的stack,当启动Skip_Grant_Table就不报错: 群里的大神找出来了因为udf_initv这个自定义函数报错. 但是一直想不通为啥服务启动要去运行自定义函数呢? ...

  3. 【资料下载区】【iCore系列及其它模块相关文档】更新日期2017/07/24

    iCore系列双核心板原理图下载区 iCore双核心板原理图下载(注释版)iCore1s双核心板原理图下载iCore2双核心板原理图下载iCore3双核心板原理图下载iCore4双核心板原理图下载 i ...

  4. 通过inotify实现反调试

    1.inotify linux下inotify可以实现监控文件系统事件(打开,读写删除等),inotify最常见的api有以下几个: inotify_init:用于创建一个 inotify 实例的系统 ...

  5. Java反射+简单工厂模式总结

    除了 new 之外的创建对象的方法 通过 new 创建对象,会使得程序面向实现编程,先举个例子,某个果园里现在有两种水果,一种是苹果,一种是香蕉,有客户想采摘园子里的水果,要求用get()方法表示即可 ...

  6. Android打开doc、xlsx、ppt等office文档解决方案

    妹子我写代码很辛苦/(ㄒoㄒ)/~~ ,转载请标明出处哦~http://blog.csdn.net/u011791526/article/details/73088768 1.Android端有什么控 ...

  7. 查看java内存情况命令

    转自:http://boendev.iteye.com/blog/882479 jinfo:可以输出并修改运行时的java 进程的opts. jps:与unix上的ps类似,用来显示本地的java进程 ...

  8. Cookiecutter: 更好的项目模板工具:(2)安装及基础使用

    安装 通过python包管理工具 命令行输入 $pip install cookiecutter 或者 # mac os经常会禁止用户全局安装python包 $pip install --user c ...

  9. Enterprise Craftsmanship

    转自:http://enterprisecraftsmanship.com/2015/04/13/dto-vs-value-object-vs-poco/ DTO vs Value Object vs ...

  10. Python __all__变量用法

    Python中一个py文件就是一个模块,“__all__”变量是一个特殊的变量,可以在py文件中,也可以在包的__init__.py中出现. 1.在普通模块中使用时,表示一个模块中允许哪些属性可以被导 ...