2012 The third Blue Bridge Cup C + + program design Undergraduate B group finals

Source: Internet
Author: User

1. Day of the Week
"The results are in the blanks" (5 points)
The National Day of 1949 (October 1) is Saturday.
The National Day of the Year (2012) is Monday.
So, from the founding of the present, how many times the National day is just Sunday?

As long as the answer, unlimited means!
You can use Windows Calendar, Windows Calculator, Excel formulas, .....
Of course, you can also program!
Do not ask to write exactly what year, as long as a number!
Never submit the source code!
The answer should not be written here, in the "answer. txt"

Answer: 9

S. Mainly the use of surplus

#include <iostream>#include<stdio.h>using namespacestd;intFinti) {    if(((i%4==0) && (i% -!=0)) || (i% -==0) )return 366; return 365;}intMain () {intsum=0;//is the number of days in Sunday    intD=6;//Day of the week    inti;  for(i=1950; i<= -; i++) {D= (f (i)%7+D)%7; if(d==0) sum++; } printf ("%d\n", sum); return 0;}
View Code

PS: It's easier to use Excel

2012 The third Blue Bridge Cup C + + program design Undergraduate B group finals

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.