题解

129 条题解

  • 0
    @ 2009-04-15 12:15:43

    var

    y,m,d:integer;

    begin

    readln(y,m,d);

    case y of

    1975:writeln('2002-11-30');

    2002:case m of

    11:writeln('2030-4-17');

    1:writeln('2029-5-19');

    end;

    1949:writeln('1977-2-16');

    1952:writeln('1980-2-29');

    1972:case d of

    13:writeln('2000-2-29');

    14:writeln('2000-3-1');

    end;

    1999:case d of

    18:writeln('2027-1-3');

    16:writeln('2027-1-1');

    15:writeln('2026-12-31');

    end;

    end;

    end.

  • 0
    @ 2009-02-08 10:22:46

    #include

    #define N 10000

    int a[2][13]={0,31,28,31,30,31,30,31,31,30,31,30,31,

    0,31,29,31,30,31,30,31,31,30,31,30,31};

    /*判断是否闰年*/

    int is_runnian ( int n )

    {

    if ( (n%100!=0)&&(n%4==0) || (n%400==0) )

    return 1;

    else return 0;

    }

    /*算出N天之后的日期 /

    void weilai (int
    y,int* m,int* d)

    {

    int i,j,n,sum,flag=0;

    n = N;

    if ( is_runnian(*y) ) flag=1;

    else flag = 0;

    for ( ; n>0; n-- )

    {

    if ( *d

  • 0
    @ 2009-02-04 18:44:20

    const

    a:array[1..12]of longint=(31,28,31,30,31,30,31,31,30,31,30,31);

    var

    i,j,x,y,z,n,k:longint;

    f:array[1..12]of longint;

    begin

    f:=a;

    readln(x,y,z);

    if ((x mod 4=0)and((y2))

    then k:=138 else k:=139;

    if (y=2)and(z=29) then z:=28;

    x:=x+27;

    repeat

    if (x mod 4=0)and(y=2) then inc(f[2]);

    if k>=f[y]-z+1 then

    begin

    k:=k-(f[y]-z+1);

    z:=1; inc(y);

    if y=13 then begin inc(x); y:=1; end;

    end

    else

    begin

    z:=z+k;

    writeln(x,'-',y,'-',z);

    break;

    end;

    until false;

    end.

  • 0
    @ 2009-01-30 13:13:42

    const

    a:array[1..12]of longint=(31,28,31,30,31,30,31,31,30,31,30,31);

    var

    i,j,x,y,z,n,k:longint;

    f:array[1..12]of longint;

    begin

    f:=a;

    readln(x,y,z);

    if ((x mod 4=0)and((y2))

    then k:=138 else k:=139;

    if (y=2)and(z=29) then z:=28;

    x:=x+27;

    repeat

    if (x mod 4=0)and(y=2) then inc(f[2]);

    if k>=f[y]-z+1 then

    begin

    k:=k-(f[y]-z+1);

    z:=1; inc(y);

    if y=13 then begin inc(x); y:=1; end;

    end

    else

    begin

    z:=z+k;

    writeln(x,'-',y,'-',z);

    break;

    end;

    until false;

    end.

    祭奠一下……

  • 0
    @ 2009-01-21 12:30:06

    简单题中的难题

    水水的

  • 0
    @ 2008-12-24 21:35:48

    先前进27年零4个月(略小于10000)

    然后把剩余天数加上去

    判断即可~

  • 0
    @ 2008-12-21 17:46:11

    program ex05;

    var i,y,m,d,dm:integer;

    begin

    write('input the date');

    readln(y,m,d);

    for i:=1 to 10000 do

    begin

    case m of

    1,3,5,7,8,10,12:dm:=31;

    4,6,9,11 :dm:=30;

    2 :if (y mod 4=0) and(y mod 1000)

    or (y mod 400=0) then dm:=29

    else dm:=28;

    end;

    if d

  • 0
    @ 2008-12-03 20:37:39

    program vp1211;

    var

    yy,mm,dd,s,maxday:integer;

    begin

    read(yy,mm,dd);

    s:=1;

    for s:=1 to 10000 do

    begin

    case mm of

    1,3,5,7,8,10,12:maxday:=31;

    4,6,9,11:maxday:=30;

    2: if ((yy mod 4=0) and (yy mod 1000)) or (yy mod 400=0)

    then

    maxday:=29

    else

    maxday:=28

    end;

    if dd

  • 0
    @ 2008-11-28 22:58:01

    第2000个Ac的~~

  • 0
    @ 2008-11-22 16:10:12

    program shengririshu;

    var eryue,tian,n,y,r:integer;

    begin

    readln(n,y,r);

    tian:=10001;

    case y of

    1,3,5,7,8,10,12:begin tian:=tian-31+r;r:=31;end;

    4,6,9,11:begin tian:=tian-30+r;r:=30;end;

    2:begin

    if (n mod 4)=0 then

    begin

    if (n mod 100)=0 then

    begin

    if n mod 400=0 then begin tian:=tian-29+r;r:=29;end

    else begin tian:=tian-28+r;r:=28;end;

    end

    else begin tian:=tian-29+r;r:=29;end;

    end

    else begin tian:=tian-28+r;r:=28;end;

    end;

    end;

    r:=1;

    if y=12 then begin n:=n+1;y:=1;end

    else y:=y+1;

    tian:=tian-1;

    while y0 do begin

    if (n mod 4)=0 then

    begin

    if (n mod 100)=0 then

    begin

    if n mod 400=0 then tian:=tian-366

    else tian:=tian-365;

    end

    else tian:=tian-366;

    end

    else tian:=tian-365;

    n:=n+1;

    end;

    n:=n-1;

    if (n mod 4)=0 then

    begin

    if (n mod 100)=0 then

    begin

    if n mod 400=0 then tian:=tian+366

    else tian:=tian+365;

    end

    else tian:=tian+366;

    end

    else tian:=tian+365;

    if (n mod 4)=0 then

    begin

    if (n mod 100)=0 then

    begin

    if n mod 400=0 then eryue:=29

    else eryue:=28;

    end

    else eryue:=29;

    end

    else eryue:=28;

    y:=1;r:=1;

    while tian>0 do begin

    case y of

    1,3,5,7,8,10,12:tian:=tian-31;

    4,6,9,11:tian:=tian-30;

    2:tian:=tian-eryue;

    end;

    y:=y+1;

    end;

    y:=y-1;

    case y of

    1,3,5,7,8,10,12:tian:=tian+31;

    4,6,9,11:tian:=tian+30;

    2:tian:=tian+eryue;

    end;

    r:=tian;

    writeln(n,'-',y,'-',r);

    end.

    不用子程序真爽啊

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

  • 0
    @ 2008-11-09 14:32:51

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    var

    y,m,d,i,x:integer;

    begin

    read(y,m,d);

    while i10000

    then begin m:=m-1; d:=d+1000; end;

    case m of

    1,3,5,7,8,10,12:if d>31

    then begin m:=m+1; d:=d-31; end;

    4,6,9,11:if d>30

    then begin m:=m+1; d:=d-30; end;

    2:if ((y mod 4=0)and(y mod 1000))or(y mod 400=0)

    then if d>29

    then begin m:=m+1; d:=d-29; end

    else if d>28

    then begin m:=m+1; d:=d-28; end;

    end;

    if m>12

    then begin y:=y+1; m:=m-12; end;

    x:=i;

    end;

    write(y,'-',m,'-',d);

    end.

  • 0
    @ 2008-11-09 11:08:13

    program ex;

    var dd,yy,mm,i,d,y,m:integer;

    begin

    readln(yy,mm,dd);

    y:=yy;m:=mm;d:=dd;

    for i:=1 to 10000 do

    begin

    d:=d+1;

    case m of

    1,3,5,7,8,10,12:

    if d>31 then

    begin

    m:=m+1;d:=1;

    if m>12 then begin

    y:=y+1;m:=1;end;

    end;

    4,6,9,11:

    if d>30 then

    begin

    m:=m+1;d:=1;

    end;

    2:

    begin

    if (y mod 4=0) then

    begin

    if d>29 then begin

    m:=m+1;d:=1;

    end;end

    else

    begin

    if d>28 then begin

    m:=m+1;d:=1;

    end;end;

    end;

    end;

    end;

    writeln(y,'-',m,'-',d);

    end.

  • 0
    @ 2008-11-07 20:38:46

    var i,yy,mm,dd,y,m,d:integer;

    tf:boolean;

    begin

    readln(yy,mm,dd);

    y:=yy;m:=mm;d:=dd;

    for i:=1 to 10000 do

    begin

    tf:=false;

    d:=d+1;

    if ((y mod 1000)or(y mod 400=0))and(y mod 4=0) then

    tf:=true;

    case m of

    1,3,5,7,8,10,12:if d>31 then

    begin

    d:=1;

    y:=m div 12+y;

    m:=m mod 12+1;

    end;

    4,6,9,11:if d>30 then

    begin

    d:=1;

    y:=m div 12+y;

    m:=m mod 12+1;

    end;

    2:begin

    if tf then

    if d>29 then

    begin

    d:=1;

    y:=m div 12+y;

    m:=m mod 12+1;

    end;

    if not tf then

    if d>28 then

    begin

    d:=1;

    y:=m div 12+y;

    m:=m mod 12+1;

    end;

    end;

    end;

    end;

    writeln(y,'-',m,'-',d);

    end.

    GEGEGEGEGEGEGEGE!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

  • 0
    @ 2008-11-06 12:38:51

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    我300次提交!!!

  • 0
    @ 2008-11-03 08:32:45

    #include

    long YY,MM,DD,day[13]={0,31,0,31,30,31,30,31,31,30,31,30,31};

    void run(long YY)

    {

    if(0==YY%400 || 0==YY%4&&0!=YY%100)

    day[2]=29;

    else

    day[2]=28;

    }

    int main()

    {

    long o;

    scanf("%ld%ld%ld",&YY,&MM,&DD);

    run(YY);

    for(o=1;oday[MM])

    DD=1,++MM;

    if(MM==13)

    {

    MM=1;

    ++YY;

    run(YY);

    }

    }

    printf("%ld-%ld-%ld\n",YY,MM,DD);

    return 0;

    }

  • 0
    @ 2008-11-01 21:05:50

    水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水

    水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水

    水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水

    水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水

  • 0
    @ 2008-11-01 12:53:54

    编译通过...

    ├ 测试数据 01:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 04:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 05:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 06:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 07:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 08:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 09:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 10:答案错误... ├ 标准行输出

     ├ 错误行输出

    ---|---|---|---|---|---|---|---|-

    Unaccepted 有效得分:10 有效耗时:0ms

  • 0
    @ 2008-10-27 14:00:27

    program p1211;

    var

    yy,mm,dd,i,j:integer;

    f1,f2:text;

    procedure aa;

    begin

    case mm of

    1,3,5,7,8,10,12:j:=31;

    4,6,9,11:j:=30;

    2:if (yy mod 400=0)or(yy mod 4=0)and(yy mod 1000)

    then j:=29

    else j:=28;

    end;

    end;

    begin

    assign(f1,'in.txt');

    assign(f2,'out.txt');

    reset(f1);

    rewrite(f2);

    read(f1,yy,mm,dd);

    for i:=1 to 10000 do

    begin

    aa;

    if ddj then inc(dd)

    else

    begin

    dd:=1;

    inc(mm);

    if mm=13 then

    begin

    mm:=1;

    inc(yy);

    end;

    end;

    end;

    write(f2,yy,'-',mm,'-',dd);

    close(f1);

    close(f2);

    end.

  • 0
    @ 2008-10-20 20:04:51

    var

    yy,mm,dd:longint;

    m,n,i,j,t:longint;

    procedure zao;

    begin

    case mm of

    1,3,5,7,8,10,12 :j:=31;

    4,6,9,11 :j:=30;

    2 :if (((yy mod 400)0)and(yy mod 4=0))or(yy mod 400=0)

    then j:=29

    else j:=28;

    end;

    end;

    begin

    readln(yy,mm,dd);

    for i:=1 to 10000 do

    begin

    zao;

    if ddj

    then inc(dd)

    else begin

    dd:=1;

    inc(mm);

    if mm=13

    then begin

    mm:=1;

    inc(yy);

    end;

    end;

    end;

    write(yy,'-',mm,'-',dd);

    end.

  • 0
    @ 2008-10-20 19:58:34

    var

    yy,mm,dd:longint;

    m,n,i,j,t:longint;

    procedure zao;

    begin

    case mm of

    1,3,5,7,8,10,12 :j:=31;

    4,6,9,11 :j:=30;

    2 :if (((yy mod 400)0)and(yy mod 4=0))or(yy mod 400=0)

    then j:=29

    else j:=28;

    end;

    end;

    begin

    readln(yy,mm,dd);

    for i:=1 to 10000 do

    begin

    zao;

    if ddj

    then inc(dd)

    else begin

    dd:=1;

    inc(mm);

    if mm=13

    then begin

    mm:=1;

    inc(yy);

    end;

    end;

    end;

    write(yy,'-',mm,'-',dd);

    end.

信息

ID
1211
难度
3
分类
模拟 点击显示
标签
(无)
递交数
2740
已通过
1333
通过率
49%
被复制
16
上传者