精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • 有關(guān)日歷計算,

    有關(guān)日歷計算,
    要求輸入n,輸出從2000.1.1開始往后n天的那一天的年月日星期.
    Given the number of days that have elapsed since January 1,2000 A.D,your mission is to find the date and the day of the week.
    Input
    The input consists of lines each containing a positive integer,which is the number of days that have elapsed since January 1,2000 A.D.The last line contains an integer -1,which should not be processed.You may assume that the resulting date won't be after the year 9999.
    Output
    For each test case,output one line containing the date and the day of the week in the format of "YYYY-MM-DD DayOfWeek",where "DayOfWeek" must be one of "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday" and "Saturday".
    Sample Input
    1730
    1740
    1750
    1751
    -1
    Sample Output
    2004-09-26 Sunday
    2004-10-06 Wednesday
    2004-10-16 Saturday
    2004-10-17 Sunday
    要c的
    其他人氣:121 ℃時間:2020-10-01 22:40:43
    優(yōu)質(zhì)解答
    以下是用C++寫的
    #include
    struct InNum
    {
    int num;
    InNum *next;
    };
    void main()
    {
    int year=2000,day=1,mouth=1,dayTemp=0,week0=6,week;
    InNum *head,*last,*p;
    head=new InNum;
    head->next=NULL;
    last=head;
    p=new InNum;
    cin>>p->num;
    p->next=NULL;
    last->next=p;
    last=last->next;
    while(p->num>0)
    {
    p=new InNum;
    cin>>p->num;
    p->next=NULL;
    last->next=p;
    last=last->next;
    }
    p=head->next;
    while(p->num>=0)
    {
    p->num--;
    while(p->num>=365)
    {
    year++;
    p->num-=365;
    }
    dayTemp=p->num;
    while(p!=NULL && p->num>28)
    {
    if(2==mouth && 0==year%4 && p->num>=29)
    {
    mouth++;
    p->num-=29;
    }
    else if(2==mouth && p->num>=28)
    {
    mouth++;
    p->num-=28;
    }
    else if(mouthnum>mouth%2+30)
    {
    p->num-=(mouth%2+30);
    mouth++;
    }
    else if(mouth>=9 && p->num>(mouth+1)%2+30)
    {
    p->num-=((mouth+1)%2+30);
    mouth++;
    }
    else
    break;
    }
    day = p->num;
    week = (dayTemp + year-2001+1)%7;
    cout
    我來回答
    類似推薦
    請使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點(diǎn),以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版