#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. 再杀掉app之后 删除NSUserDefault存在本地的数据

    这两天在处理  app退出后删除本地数据  在appDelegate里的这个函数里设置发现进不去 - (void)applicationWillTerminate:(UIApplication*)ap ...

  2. MySQL 加锁处理分析<转>

    1    背景    1 1.1    MVCC:Snapshot Read vs Current Read    2 1.2    Cluster Index:聚簇索引    3 1.3    2P ...

  3. sql查父节点小笔记

    )) ),sortNum int) as BEGIN DECLARE @sortNum int --得到当前id的父id, select @id = ParentId, @sortNum =Sortn ...

  4. 在Ubuntu主机下实现与Windows虚拟机共享文件夹

    一.概述 由于要实现Ubuntu主机中的一些文件与Windows虚拟机共享,因此要创建一个共享文件夹映射到虚拟机中. 网上许多都是Windows主机+Linux虚拟机的配置,在此分享主机是Linux的 ...

  5. Linux 文件普通权限_011

    一.文件权限10个字符对应类型和权限 二.Linux普通文件和Linux目录读.写.执行权限说明 标注:Linux 中的文件名是存在于父目录的block里面,并指向这个文件的inode节点 1.lin ...

  6. Ubuntu下Ansible安装和使用

    Ansible是一个批量部署的工具 参考:Ansible中文权威指南 1.安装 sudo apt-get install software-properties-common sudo apt-add ...

  7. IT观察】网络通信、图片显示、数据库操作……Android程序员如何利用开源框架

    每个Android 程序员都不是Android应用开发之路上孤军奋战的一个人,GitHub上浩如烟海的开源框架或类库就是前人为我们发明的轮子,有的轮子能提高软件性能,而有的轮子似乎是以牺牲性能为代价换 ...

  8. 使用for of循环遍历获取的nodeList,配置babel编译,webpack打包之后在iphone5下报错

    报错信息: Symbol.iterator is not a function [duplicate] 代码示例: function insertCta() { let ctaArr = Array. ...

  9. 智能聊天机器人——基于RASA搭建

    前言: 最近了解了一下Rasa,阅读了一下官方文档,初步搭建了一个聊天机器人. 官方文档:https://rasa.com/docs/ 搭建的chatbot项目地址: https://github.c ...

  10. js返回上一页并刷新、返回上一页、自动刷新页面

    一.返回上一页并刷新 <a href="javascript:" onclick="self.location=document.referrer;"&g ...