{"id":1057,"date":"2024-01-16T18:01:01","date_gmt":"2024-01-16T10:01:01","guid":{"rendered":""},"modified":"2024-01-16T18:01:01","modified_gmt":"2024-01-16T10:01:01","slug":"\u6211\u7684\u53c2\u8003\u56db\u73ed\u4e09\u5012","status":"publish","type":"post","link":"https:\/\/mushiming.com\/1057.html","title":{"rendered":"\u6211\u7684\u53c2\u8003\u56db\u73ed\u4e09\u5012"},"content":{"rendered":"
#include<iostream>\n\nusing namespace std;\nclass work\n{\nprivate:\t\t\t\/\/ \u5e74 \u6708 \u65e5\t\n\tbool Isyear ( int year )\t\t\/\/\u5224\u65ad\u662f\u5426\u4e3a \u95f0\u5e74\n\t{\n\t\treturn ( (0 == year % 4 && 0 != year % 400 ) || ( 0 == year % 400 ));\n\t}\n\tint GetmonthDay ( int year, int month )\t\t\/\/\u8fd4\u56de\u67d0\u5e74\u67d0\u6708\u7684\u5929\u6570\n\t{\n\t\tint Daynumber;\n\t\tif ( 2 == month )\t\t\t\/\/2\u6708\u5355\u72ec\u5904\u7406\n\t\t{\n\t\t\tif ( Isyear ( year ) )\n\t\t\t\tDaynumber = 29;\n\t\t\telse \n\t\t\t\tDaynumber = 28;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( (month < 8 && 1 == month % 2) || ( month >= 8 && month % 2 == 0))\t\t\/\/ 8\u6708\u524d\u5947\u6570 31\u5929 8\u6708\u540e \u5076\u6570 31\u5929\n\t\t\t\tDaynumber = 31;\n\t\t\tif (( month < 8 && 0 == month % 2) || ( month >= 8 && month % 2 == 1 ))\n\t\t\t\tDaynumber = 30;\n\t\t}\n\t\treturn Daynumber;\t\n\t}\npublic:\n\tint NowToDay ( int year, int month, int day)\t\/\/\u8ba1\u7b97\u6709\u591a\u5c11\u5929\u3002\u3002\u3002\n\t{\n\t\tint DiDay, i;\n\/\/2013\u5e74\n\t\tif ( year == 2013 )\n\t\t{\n\t\t\tDiDay = 0;\n\t\t\tfor ( i = 9 ; i < month; i++)\t\t\/\/\u6708\u4efd\u5929\u6570 \u73b0\u5728\u662f \u4ece9\u6708\u7b97\n\t\t\t\tDiDay += GetmonthDay ( year, i);\n\t\t\tDiDay += day - 10;\t\t\t\/\/\u4ece10\u53f7\u5f00\u59cb\n\t\t}\n\/\/ 2014\u5e74\u4ee5\u540e\n\t\tif ( year >= 2014)\n\t\t{\n\t\t\tDiDay = 0;\n\t\t\tfor ( i = 9 ; i < 13; i++)\t\t\/\/\u6708\u4efd\u5929\u6570 \u73b0\u5728\u662f \u4ece9\u6708\u7b97\u7b97\u5230 \u5e74\u5e95\n\t\t\t\tDiDay += GetmonthDay ( year, i);\n\t\t\tDiDay += day - 10;\n\t\t\tfor ( i = 2014 ; i < year ; i ++)\t\t\t\/\/2014\u5e74 \u591a\u5c11\u5929\n\t\t\t\tif ( Isyear ( i ))\n\t\t\t\t\tDiDay += 366 ;\t\t\/\/\u95f0\u5e74+366\n\t\t\t\telse\n\t\t\t\t\tDiDay += 365;\n\t\t\tfor ( i = 0; i < month ; i++)\n\t\t\t\tDiDay += GetmonthDay ( year , i); \/\/ \u6bcf\u6708\u591a\u5c11\u5929\n\t\t\tDiDay = DiDay - (GetmonthDay( year, i) - day);\t\t\t\/\/\u8fd9\u4e2a\u6708\u6709\u51e0\u5929\u3002 \n\t\t}\n\t\treturn DiDay;\t\n\t\t\n\t}\n\tbool Input ( int year, int month, int day)\n\t{\n\t\tint Tureday;\n\t\tif( year < 2013 || month >= 13 || day > 31 )\t\t\/\/\u5982\u679c\u8f93\u5165\u7684\u65e5\u671f\u5c0f\u4e8e 2013 \u6216\u8005 \u5927\u4e8e 13\u6708 \u6216\u8005\u5927\u4e8e31 \u5929 \u8fd4\u56de\u5047\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tTureday = GetmonthDay ( year, month );\n\t\t\tif ( day > Tureday )\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\tint FindDayB(int year, int month, int day )\t\t\/\/\u67e5\u627e\u67d0\u4e00\u5929\u662f\u4f11\u606f\u8fd8\u662f\u4e0a\u73ed\n\t{\n\t\tint all;\n\t\tchar week[8][20]= {\n \n {\"\u5de5\u4f5c\u7b2c\u4e00\u5929\"},{\"\u5de5\u4f5c\u7b2c\u4e8c\u5929\"},{\"\u5de5\u4f5c\u7b2c\u4e09\u5929\"},{\"\u5de5\u4f5c\u7b2c\u56db\u5929\"},\n\t\t{\"\u5de5\u4f5c\u7b2c\u4e94\u5929\"},{\"\u5de5\u4f5c\u7b2c\u516d\u5929\"},{\"\u4f11\u606f\u7b2c\u4e00\u5929\"},{\"\u4f11\u606f\u7b2c\u4e8c\u5929\"}};\n\t\tall = NowToDay (year, month, day);\n\t\tchar night[3][20] = {\n \n {\"\u4e2d\u73ed\"},{\"\u591c\u73ed\"},{\"\u65e9\u73ed\"}};\n\t\tcout<<\"---------\"<<night[((all + 6) \/ 8) % 3];\n\t\tcout<<\"B\u7ec4\u5458\u5de5\"<<week[(all + 6)% 8]<<\"---------\"<<endl<<endl;\n\n\t\treturn 0;\n\t}\n\tint FindDayA(int year, int month, int day )\t\t\/\/\u67e5\u627e\u67d0\u4e00\u5929\u662f\u4f11\u606f\u8fd8\u662f\u4e0a\u73ed\n\t{\n\t\tint all;\n\t\tchar week[8][20]= {\n \n {\"\u5de5\u4f5c\u7b2c\u4e00\u5929\"},{\"\u5de5\u4f5c\u7b2c\u4e8c\u5929\"},{\"\u5de5\u4f5c\u7b2c\u4e09\u5929\"},{\"\u5de5\u4f5c\u7b2c\u56db\u5929\"},\n\t\t{\"\u5de5\u4f5c\u7b2c\u4e94\u5929\"},{\"\u5de5\u4f5c\u7b2c\u516d\u5929\"},{\"\u4f11\u606f\u7b2c\u4e00\u5929\"},{\"\u4f11\u606f\u7b2c\u4e8c\u5929\"}};\n\t\tall = NowToDay (year, month, day);\n\t\tchar night[3][20] = {\n \n {\"\u591c\u73ed\"},{\"\u65e9\u73ed\"},{\"\u4e2d\u73ed\"}};\n\t\tcout<<\"---------\"<<night[((all + 4) \/ 8) % 3];\n\t\tcout<<\"A\u7ec4\u5458\u5de5\"<<week[(all + 4)% 8]<<\"---------\"<<endl<<endl;\n\t\treturn 0;\n\t}\n\t\tint FindDayC(int year, int month, int day )\t\t\/\/\u67e5\u627e\u67d0\u4e00\u5929\u662f\u4f11\u606f\u8fd8\u662f\u4e0a\u73ed\n\t{\n\t\tint all;\n\t\tchar week[8][20]= {\n \n {\"\u5de5\u4f5c\u7b2c\u4e00\u5929\"},{\"\u5de5\u4f5c\u7b2c\u4e8c\u5929\"},{\"\u5de5\u4f5c\u7b2c\u4e09\u5929\"},{\"\u5de5\u4f5c\u7b2c\u56db\u5929\"},\n\t\t{\"\u5de5\u4f5c\u7b2c\u4e94\u5929\"},{\"\u5de5\u4f5c\u7b2c\u516d\u5929\"},{\"\u4f11\u606f\u7b2c\u4e00\u5929\"},{\"\u4f11\u606f\u7b2c\u4e8c\u5929\"}};\n\t\tall = NowToDay (year, month, day);\n\t\tchar night[3][20] = {\n \n {\"\u4e2d\u73ed\"},{\"\u591c\u73ed\"},{\"\u65e9\u73ed\"}};\n\t\tcout<<\"---------\"<<night[((all) \/ 8) % 3];\n\t\tcout<<\"C\u7ec4\u5458\u5de5\"<<week[(all )% 8]<<\"---------\"<<endl<<endl;\n\t\treturn 0;\n\t}\n\t\t\tint FindDayD(int year, int month, int day )\t\t\/\/\u67e5\u627e\u67d0\u4e00\u5929\u662f\u4f11\u606f\u8fd8\u662f\u4e0a\u73ed\n\t{\n\t\tint all;\n\t\tchar week[8][20]= {\n \n {\"\u5de5\u4f5c\u7b2c\u4e00\u5929\"},{\"\u5de5\u4f5c\u7b2c\u4e8c\u5929\"},{\"\u5de5\u4f5c\u7b2c\u4e09\u5929\"},{\"\u5de5\u4f5c\u7b2c\u56db\u5929\"},\n\t\t{\"\u5de5\u4f5c\u7b2c\u4e94\u5929\"},{\"\u5de5\u4f5c\u7b2c\u516d\u5929\"},{\"\u4f11\u606f\u7b2c\u4e00\u5929\"},{\"\u4f11\u606f\u7b2c\u4e8c\u5929\"}};\n\t\tall = NowToDay (year, month, day);\n\t\tchar night[3][20] = {\n \n {\"\u65e9\u73ed\"},{\"\u4e2d\u73ed\"},{\"\u591c\u73ed\"}};\n\t\tcout<<\"---------\"<<night[((all +2) \/ 8) % 3];\n\t\tcout<<\"D\u7ec4\u5458\u5de5\"<<week[(all+2 )% 8]<<\"---------\"<<endl<<endl;\n\t\treturn 0;\n\t}\n\n\n\n\n\n\n};<\/code><\/pre>\n<\/p>\n","protected":false},"excerpt":{"rendered":"\u6211\u7684\u53c2\u8003\u56db\u73ed\u4e09\u5012#includeusingnamespacestd;classwork{private:\t\t\t\/\/\u5e74\u6708\u65e5\t\tboolIsyear(intyear)\t\t\/\/\u5224\u65ad\u662f\u5426\u4e3a\u95f0\u5e74\t{\t\tret...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/1057"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=1057"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/1057\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=1057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=1057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=1057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}