Let A, B, C, D denote integer variables that have the following values:
A = the month of the year, with March having the value 1, April the
value 2, . . ., December the value 10, and January and February being
counted as months 11 and 12 of the preceding year (in which
case,subtract 1 from C)
B = the day of the month (1, 2, 3, . . . , 30, 31)
C = the year of the century (e.g. C = 89 for the year 1989)
D = the century (e.g. D = 19 for the year 1989)
Note: if the month is January or February, then the preceding year is used for computation. This is because there was a period in history when March 1st, not January 1st, was the beginning of the year.
Let W, X, Y, Z, R also denote integer variables. Compute their values in the following order using
integer arithmetic:
W = (13*A - 1) / 5
X = C / 4
Y = D / 4
Z = W + X + Y + B + C - 2*D
R = the remainder when Z is divided by 7
The R is what we want to know
阅读(788) | 评论(0) | 转发(0) |