Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

不会蔡勒公式的可看这里,Example

Posted by applepi at 2010-10-14 17:34:38 on Problem 3047
#include <stdio.h>

int main ()
{
    int w, c, y, m, d, a;
    scanf("%d %d %d", &a, &m, &d);
    if (m == 1 || m == 2) m += 12, a--;
    c = a / 100;
    y = a % 100;
    w = y + (int)(y / 4) + (int)(c / 4) - 2 * c + (int)(26 * (m + 1) / 10) + d - 1;
    w = (70000 + w) % 7;
    switch (w)
    {
           case 0: printf("sunday\n"); break;
           case 1: printf("monday\n"); break;
           case 2: printf("tuesday\n"); break;
           case 3: printf("wednesday\n"); break;
           case 4: printf("thursday\n"); break;
           case 5: printf("friday\n"); break;
           case 6: printf("saturday\n"); break;
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator