和中国的节日不同,美国的节假日通常是选择某个月的第几个星期几这种形式,因此每一年的放假日期都不相同。具体规则如下:
* 1月1日:元旦
* 1月的第三个星期一:马丁·路德·金纪念日
* 2月的第三个星期一:总统节
* 5月的最后一个星期一:阵亡将士纪念日
* 7月4日:美国国庆
* 9月的第一个星期一:劳动节
* 11月的第四个星期四:感恩节
* 12月25日:圣诞节
现在给出一个年份,请你帮忙生成当年节日的日期。
输入包含多组数据,每组数据包含一个正整数year(2000≤year≤9999)。
对应每一组数据,以“YYYY-MM-DD”格式输出当年所有的节日日期,每个日期占一行。
每组数据之后输出一个空行作为分隔。
2014 2013
2014-01-01 2014-01-20 2014-02-17 2014-05-26 2014-07-04 2014-09-01 2014-11-27 2014-12-25 2013-01-01 2013-01-21 2013-02-18 2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
#include <iostream> #include <cstdio> using namespace std; // 根据 年-月-日 通过蔡勒公式计算当前星期几 int day_of_week(int year, int month, int day){ if(month == 1 || month == 2){ month += 12; year -= 1; } int century = year / 100; year %= 100; int week = century / 4 - 2 * century + year + year / 4 + (13 * (month + 1)) / 5 + day - 1; week = (week % 7 + 7) % 7; if(week == 0){ week = 7; } return week; } // 给定年月和第几周的星期几,求出是该月的几号几号 int day_of_demand(int year, int month, int count, int d_of_week){ int week = day_of_week(year, month, 1);// 计算该月1号是星期几 // 1 + 7(n - 1) + (所求星期数 + 7 - 1号星期数) % 7 int day = 1 + (count - 1) * 7 + (7 + d_of_week - week) % 7; return day; } // 元旦 void new_year_day(int year){ printf("%d-01-01\n", year); } // 马丁·路德·金纪念日(1月的第三个星期一) void martin_luther_king_day(int year){ printf("%d-01-%02d\n", year, day_of_demand(year, 1, 3, 1)); } // 总统日(2月的第三个星期一) void president_day(int year){ printf("%d-02-%02d\n", year, day_of_demand(year, 2, 3, 1)); } // 阵亡将士纪念日(5月的最后一个星期一) void memorial_day(int year){ // 从 6 月往前数 int week = day_of_week(year, 6, 1); // 星期一的话,从 31 号往前数 6 天,否则,数 week - 2 天 int day = 31 - ((week == 1) ? 6 : (week - 2)); printf("%d-05-%02d\n", year, day); } // 国庆 void independence_day(int year){ printf("%d-07-04\n", year); } // 劳动节(9月的第一个星期一) void labor_day(int year){ printf("%d-09-%02d\n", year, day_of_demand(year, 9, 1, 1)); } // 感恩节(11月的第四个星期四) void thanks_giving_day(int year){ printf("%d-11-%02d\n", year, day_of_demand(year, 11, 4, 4)); } // 圣诞节 void christmas(int year){ printf("%d-12-25\n\n", year); } // 美国节日 void holiday_of_usa(int year){ new_year_day(year); martin_luther_king_day(year); president_day(year); memorial_day(year); independence_day(year); labor_day(year); thanks_giving_day(year); christmas(year); } int main(){ int year; while(cin >> year){ holiday_of_usa(year); } return 0; }
#include "iostream" using namespace std; int WeekToDay(int y,int m,int c,int w,bool B){//输入哪年哪月第几个星期几,以及正数还是倒数,输出几号 int d,week,i; if(m==1){m=13;y--;}//公式要求1月、2月要转为上一年13、14月 if(m==2){m=14;y--;} i = 0; for(d = B?1:31; d <= B?31:1; B?(d++):(d--)){//B:正数/倒数 week =(d + 2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7;//蔡勒公式 if(week+1 == w) ++i; if(i == c) break; } return d; } int main(void){ int y; while(cin>>y){ cout<<y<<"-01-01"<<endl; printf("%d-01-%02d\n",y,WeekToDay(y,1,3,1,1)); printf("%d-02-%02d\n",y,WeekToDay(y,2,3,1,1)); printf("%d-05-%02d\n",y,WeekToDay(y,5,1,1,0));//倒数 cout<<y<<"-07-04"<<endl; printf("%d-09-%02d\n",y,WeekToDay(y,9,1,1,1)); printf("%d-11-%02d\n",y,WeekToDay(y,11,4,4,1)); cout<<y<<"-12-25"<<endl<<endl; } return 0; }
import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Scanner; public class _t142 { public static void main(String[] args) { Scanner in = new Scanner(System.in); while(in.hasNext()){ int y=in.nextInt(); int mon[]=new int[]{1,2,5,9,11}; int len=mon.length; int wek[]=new int[len]; // 创建 Calendar 对象 Calendar cal = Calendar.getInstance(); try { // 对 calendar 设置时间的方法 // 设置传入的时间格式 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-M-d"); for (int i = 0; i < len; i++) {// 指定一个日期 Date date = dateFormat.parse(y+"-"+mon[i]+"-1"); cal.setTime(date);// 对 calendar 设置为 date 所定的日期 int week = cal.get(Calendar.DAY_OF_WEEK)-1; //每月1号位于星期几 if(week==0) week=7; wek[i]=week; // System.out.println(week); } } catch (Exception e) { } System.out.println(y+"-01-01"); //1月的第三个星期一 int jan=wek[0]; int rs=0; String strRs=""; if(jan==1){ rs=2*7+1; } else{ rs=3*7-(jan-1)+1; } strRs=rs/10==0?"0"+rs:String.valueOf(rs); System.out.println(y+"-01-"+strRs); //2月的第三个星期一 int feb=wek[1]; if(feb==1){ rs=2*7+1; } else{ rs=3*7-(feb-1)+1; } strRs=rs/10==0?"0"+rs:String.valueOf(rs); System.out.println(y+"-02-"+strRs); //5月的最后一个星期一(星期一:一个月(4~5次)) int may=wek[2]; if(may>=6){//第五个星期一 rs=may==6?31:30; } else{//第四个星期一 rs=4*7-(may-1)+1; } strRs=rs/10==0?"0"+rs:String.valueOf(rs); System.out.println(y+"-05-"+strRs); System.out.println(y+"-07-04"); //9月的第一个星期一 int sep=wek[3]; if(sep==1){ rs=1; } else{ rs=1*7-(sep-1)+1; } strRs=rs/10==0?"0"+rs:String.valueOf(rs); System.out.println(y+"-09-"+strRs); //11月的第四个星期四 int nov=wek[4]; rs=4*7-(nov-1)+1+3; strRs=rs/10==0?"0"+rs:String.valueOf(rs); System.out.println(y+"-11-"+strRs); System.out.println(y+"-12-25"); System.out.println(); } } }
#include <iostream> #include <vector> using namespace std; int main() { int year=0; while(cin>>year) { int arr[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; vector<int> week(7); int weekday=0; for(int i=2000;i<year;i++) weekday+=365+(((i%4==0)&&(i%100!=0))||(i%400==0)); weekday=(weekday+5)%7;//该年的1月1号是星期几(以2000年1月1号为星期六为基准) int day=1;//记录当前是几号 if(((year%4==0)&&(year%100!=0))||(year%400==0))//如果这年是闰年,二月按29天计算 arr[2]=29; for(int month=1/*记录当前是几月*/;month<13;day++,weekday=(weekday+1)%7) { if(day==arr[month]+1) { for(auto& e:week)//将记录数组置空 e=0; day=1; month++; } week[weekday]++;//利用week来记录现在经过了几个星期几 if(month==1&&day==1) printf("%d-01-01\n",year); if(month==1&&week[0]==3&&weekday==0)//week[0]的值表示这个月经过了第几个星期一 printf("%d-%02d-%02d\n",year,1,day); if(month==2&&week[0]==3&&weekday==0) printf("%d-%02d-%02d\n",year,2,day); if(month==5&&weekday==0&&day>=25) printf("%d-%02d-%02d\n",year,5,day); if(month==7&&day==4) printf("%d-07-04\n",year); if(month==9&&week[0]==1&&weekday==0) printf("%d-%02d-%02d\n",year,9,day); if(month==11&&week[3]==4&&weekday==3) printf("%d-%02d-%02d\n",year,11,day); if(month==12&&day==25) printf("%d-12-25\n",year); } cout<<endl; } return 0; }
#include<iostream> using namespace std; //输入 某年某月第几个星期几,正数还是倒数,输出 几号 int WeekDay(int y,int m,int n,int w,bool B) { int day,week,i=0; if(m==1) {m=13; y--;} if(m==2) {m=14; y--;} for( day = B?1:31; day <= B?31:1; B?(day++):(day--) ) { week=(day + 2*m + 3*(m+1)/5 + y + y/4 - y/100 + y/400)%7;//蔡勒公式 if(week+1==w) ++i; if(i==n) break; } return day; } int main(void) { int year; while(cin>>year) { cout<<year<<"-01-01"<<endl; //元旦 //WeekDay(年,月,第几个星期,星期几,正数1倒数0) printf("%d-01-%02d\n",year,WeekDay(year,1,3,1,1)); printf("%d-02-%02d\n",year,WeekDay(year,2,3,1,1)); printf("%d-05-%02d\n",year,WeekDay(year,5,1,1,0)); cout<<year<<"-07-04"<<endl; printf("%d-09-%02d\n",year,WeekDay(year,9,1,1,1)); printf("%d-11-%02d\n",year,WeekDay(year,11,4,4,1)); cout<<year<<"-12-25"<<endl<<endl; } return 0; }
#include <iostream> #include <string> #include <unordered_map> #include <vector> using namespace std; string s; static vector<int> m({31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}); unordered_map<int, string> res; class date { public: int year; int month; int day; int weekday; date() = default; date(int x, int y, int z, int w) : year(x), month(y), day(z), weekday(w) { } bool check(int x) { return x % 400 == 0 || x % 4 == 0 && x % 100 != 0; } int GetMonthDay(int x, int y) { if (check(x) && y == 2) return 29; else return m[y - 1]; } date& operator++() { ++day; if (day > GetMonthDay(year, month)) { day = 1; ++month; if (month > 12) { month = 1; ++year; } } ++weekday; if (weekday > 7) weekday = 1; return *this; } date& operator--() { --day; if (day < 1) { --month; if (month < 1) { month = 12; --year; } day = GetMonthDay(year, month); } --weekday; if (weekday < 1) weekday = 7; return *this; } }; void init() { date ans(2024, 5, 13, 1); while (ans.year != 2000) --ans; while (ans.month != 1) --ans; while (ans.day != 1) --ans; while (ans.year <= 9999) { int nowyear = ans.year; string now; now += to_string(ans.year) + "-01-01\n"; int n = ans.weekday == 1; while (n != 3) { ++ans; if (ans.weekday == 1) ++n; } now += to_string(ans.year) + "-01-" + to_string(ans.day) + '\n'; while (ans.month != 2) ++ans; n = ans.weekday == 1; while (n != 3) { ++ans; if (ans.weekday == 1) ++n; } now += to_string(ans.year) + "-02-" + to_string(ans.day) + '\n'; while (ans.month != 5) ++ans; string last; while (ans.month != 6) { ++ans; if (ans.weekday == 1 && ans.month != 6) last = to_string(ans.day); } now += to_string(ans.year) + "-05-" + last + '\n'; now += to_string(ans.year) + "-07-04\n"; while (ans.month != 9) ++ans; n = ans.weekday == 1; while (n != 1) { ++ans; if (ans.weekday == 1) ++n; } now += to_string(ans.year) + "-09-"; if (ans.day < 10) now += '0'; now += to_string(ans.day) + '\n'; while (ans.month != 11) ++ans; n = ans.weekday == 4; while (n != 4) { ++ans; if (ans.weekday == 4) ++n; } now += to_string(ans.year) + "-11-" + to_string(ans.day) + '\n'; now += to_string(ans.year) + "-12-25\n"; res[nowyear] = now; while (ans.year == nowyear) ++ans; } } int main() { init(); while (cin >> s) cout << res[stoi(s)] << endl; return 0; }
import java.util.Scanner; import java.time.DayOfWeek; import java.time.LocalDate; import java.time.Month; import java.time.temporal.TemporalAdjusters; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 while (in.hasNextInt()) { // 注意 while 处理多个 case int year = in.nextInt(); // 指定的年份 // 元旦 LocalDate newYear = LocalDate.of(year, Month.JANUARY, 1); System.out.println(newYear); // 马丁·路德·金纪念日(1月的第三个星期一) LocalDate mlkDay = LocalDate.of(year, Month.JANUARY, 1) .with(TemporalAdjusters.dayOfWeekInMonth(3, DayOfWeek.MONDAY)); System.out.println(mlkDay); // 总统节(2月的第三个星期一) LocalDate presidentsDay = LocalDate.of(year, Month.FEBRUARY, 1) .with(TemporalAdjusters.dayOfWeekInMonth(3, DayOfWeek.MONDAY)); System.out.println(presidentsDay); // 阵亡将士纪念日(5月的最后一个星期一) LocalDate memorialDay = LocalDate.of(year, Month.MAY, 1) .with(TemporalAdjusters.lastInMonth(DayOfWeek.MONDAY)); System.out.println(memorialDay); // 美国国庆 LocalDate independenceDay = LocalDate.of(year, Month.JULY, 4); System.out.println(independenceDay); // 劳动节(9月的第一个星期一) LocalDate laborDay = LocalDate.of(year, Month.SEPTEMBER, 1) .with(TemporalAdjusters.firstInMonth(DayOfWeek.MONDAY)); System.out.println(laborDay); // 感恩节(11月的第四个星期四) LocalDate thanksgivingDay = LocalDate.of(year, Month.NOVEMBER, 1) .with(TemporalAdjusters.dayOfWeekInMonth(4, DayOfWeek.THURSDAY)); System.out.println(thanksgivingDay); // 圣诞节 LocalDate christmasDay = LocalDate.of(year, Month.DECEMBER, 25); System.out.println(christmasDay); System.out.println(); } } }
import java.util.*; public class Main{ public static boolean isLeapYear(int y){ if(y % 100 != 0){ if(y % 4 == 0){ return true; } }else{ if(y % 400 == 0){ return true; } } return false; } static int[] days = new int[]{0,31,28,31,30,31,30,31,31,30,31,30,31}; public static int nDays(int y,int m,int d){ int n = d; for(int i = 1; i <= m-1; i++){ n += days[i]; } if(m > 2 && isLeapYear(y)){ n++; } return n; } public static int diff(int y,int m,int d){ return y-1+(y-1)/4-(y-1)/100+(y-1)/400+nDays(y,m,d); } public static int week(int y,int m,int d){ int w = diff(y,m,d)%7; if(w == 0){ w = 7; } return w; } //已知当月的1号是星期w,求第n个星期e是多少号 public static int m1(int w,int n,int e){ return 1+(n-1)*7+(7-w+e)%7; } public static int m2(int w){ int d = (w == 1)?7:(w-1); return 32-d; } public static void main(String[] args){ Scanner scan = new Scanner(System.in); while(scan.hasNext()) { int y = scan.nextInt(); System.out.printf("%d-01-01\n",y); int w; w = week(y,1,1); System.out.printf("%d-01-%02d\n",y,m1(w,3,1)); //第三个星期一 w = week(y,2,1); System.out.printf("%d-02-%02d\n",y,m1(w,3,1)); //第三个星期一 w = week(y,6,1); System.out.printf("%d-05-%02d\n",y,m2(w)); System.out.printf("%d-07-04\n",y); w = week(y,9,1); System.out.printf("%d-09-%02d\n",y,m1(w,1,1)); //第一个星期一 w = week(y,11,1); System.out.printf("%d-11-%02d\n",y,m1(w,4,4)); //第四个星期四 System.out.printf("%d-12-25\n",y); System.out.println(); } } }
import java.util.*; public class Main{ public static boolean isRn(int year) {//判断是不是闰年 if(((year%4==0)&&year%100!=0)||(year%400==0)){ return true; } return false; } public static int day_of_week(int year, int month, int day)//蔡勒公式,给年月日计算出这天是星期几 { if (month == 1 || month == 2) { month += 12; year -= 1; } int century = year / 100; year %= 100; int week = year + (year / 4) + (century / 4) - 2 * century + 26 * (month + 1) / 10 + day - 1; week = (week % 7 + 7) % 7; if (week == 0) { week = 7; } return week; } public static void printFunc(int y,int m,int d) { String str1="-"; String str2="-"; boolean f1=false; boolean f2=false; if(m/10==0){ f1=true; str1+=0; } if(d/10==0){ f2=true; str2+=0; } System.out.println(y + str1 + m + str2 + d); } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int y = scanner.nextInt(); boolean f=isRn(y); for (int m = 1; m <= 12; ) { int x = 0; if (m % 2 == 0) {//偶数月 if (m == 2) { if (f) { x = 29; } else { x = 28; } } else { x = 30; } } else { x = 31; } int tmp=day_of_week(y,m,1);//这年这月第一天是星期几 boolean flg=false;//后面用于标记劳动节的 for (int d = 1; d <= x; d++) { int j=(d+tmp)/7+1;//第几个星期 // 注意,第几个星期!=第几个星期几 //比如你这个月是星期4是1号,那你第一个星期3,是第二个星期才出现的 int w = day_of_week(y,m,d);//这年这月这日是星期几 //蔡勒公式,给一个年月日计算是星期几 if ((m == 1 && d == 1) || (m == 7 && d == 4) || (m == 12 && d == 25)) {//指定节日 if(m<10){ System.out.println(y + "-0" + m + "-0" + d); }else{ System.out.println(y + "-" + m + "-" + d); } continue; } else if (m == 1 && w == 1) {//马丁路德金纪念日 if(1<tmp){ //比如你这个月是星期3是1号,那你第三个星期1,是第四个星期才出现的 if(4==j){ printFunc(y,m,d); } }else{//这个月第一天就是星期1,那第三个星期1,就是第三个星期出现 if(3==j){ printFunc(y,m,d); } } } else if (m == 2 && w == 1) {//总统节 if(1<tmp){ if(4==j){ printFunc(y,m,d); } }else{ if(3==j){ printFunc(y,m,d); } } } else if (m == 5 && w == 1) {//阵亡将士纪念日 //五月第一天是星期一,最后一个星期一是在 第5个星期 //五月第一天是星期日,最后一个星期一是在 第6个星期 int k=0; for(int a=0;a<7;a++){ if (flg==true){ break; } if(day_of_week(y,5,31-a)==1){ printFunc(y,m,31-a); flg=true; } } } else if (m == 9 && w == 1) {//劳动节 if(1<tmp){ if(2==j){ printFunc(y,m,d); } }else{ if(1==j){ printFunc(y,m,d); } } } else if (m == 11 && w == 4) {//感恩节 if(4<tmp){ if(5==j){ printFunc(y,m,d); } }else{ if(4==j){ printFunc(y,m,d); } } } } m++; } System.out.println(); } } }
import java.util.*; public class Main{ public static final int arr[] = {31,28,31,30,31,30,31,31,30,31,30,31}; //判断是否为闰年 public static boolean isLeap(int n){ return (((n % 4 == 0 && n % 100 != 0) || n % 400 == 0)); } //给定M-Y-D,返回这一年一共过了多少天 public static int nDays(int y,int m,int d){ int n = d; for(int i = 0;i < m - 1;i++){ n += arr[i]; } if(m > 2 && isLeap(y)){ n++; } return n; } //给定M-Y-D,找到从公元前1年12月31日开始过了过久。就出它%7得t同余数 public static int diff(int y,int m,int d){ return (y - 1)+(y - 1)/4 - (y - 1)/100 + (y -1)/400 + nDays(y,m,d); } //根据y-m-d,求出星期几 public static int week(int y,int m,int d){ int w = diff(y, m, d) % 7; if(w == 0){ return 7; } return w; } //根据1号是星期几,求第n个星期e是几号 public static int m1(int w,int n,int e){ return 1 + (n - 1) * 7 + (7 - w + e) % 7; } //根据6月1号星期w,求5月的最后一个星期一 public static int m2(int w){ int d = (w == 1 ? 7 : w - 1); return 32 - d; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int y = sc.nextInt(); /* 1月1日:元旦 * 1月的第三个星期一:马丁·路德·金纪念日 * 2月的第三个星期一:总统节 * 5月的最后一个星期一:阵亡将士纪念日 * 7月4日:美国国庆 * 9月的第一个星期一:劳动节 * 11月的第四个星期四:感恩节 * 12月25日:圣诞节 */ System.out.printf("%d-01-01\n",y); int w; w = week(y,1,1); System.out.printf("%d-01-%02d\n",y,m1(w,3,1)); w = week(y,2,1); System.out.printf("%d-02-%02d\n",y,m1(w,3,1)); w = week(y,6,1); System.out.printf("%d-05-%02d\n",y,m2(w)); System.out.printf("%d-07-04\n",y); w = week(y,9,1); System.out.printf("%d-09-%02d\n",y,m1(w,1,1)); w = week(y,11,1); System.out.printf("%d-11-%02d\n",y,m1(w,4,4)); System.out.printf("%d-12-25\n",y); System.out.println(); } } }
#include<iostream> using namespace std; int main() { int year; int month[6] = { 1,2,5,7,9,11 }; while (cin >> year) { cout << year << "-" << 0<<1 << "-" << 0<<1 << endl; for (int i = 0; i < 6; i++) { if (month[i] == 7) { cout << year << "-" << 0<<7 << "-" <<0 <<4 << endl; continue; } int day = 1; int c = year / 100; int m = month[i]; int y=year; if (month[i] == 1 || month[i] == 2) { y = year - 1;; m += 12; } y = y % 100; int w = (c / 4) - 2 * c + y + (y / 4) + (13 * (m + 1) / 5) + day - 1; while (w < 0) w += 7; w %= 7; if (w == 0) w = 7; if (month[i] != 11) { if (w != 1) day += 8 - w; if (month[i] == 1 || month[i] == 2) day += 14; if (month[i] == 5) { day += 21; if (21 + 7 + 8 - w <= 31) day += 7; } } else { int arr[7] = { 3,2,1,0,6,5,4 }; day +=arr[w-1]; day += 21; } cout << year << "-" ; if(month[i]>=1&&month[i]<=9) cout<<0; cout<<month[i]<< "-"; if(day>=1&&day<=9) cout<<0; cout<< day << endl; } cout << year << "-" << 12 << "-" << 25 << endl; } return 0; } 哪里不对?
为什么过不了 自测试了好几个没问题哈#include<iostream> #include<vector> using namespace std; vector<int> leap = { 31,29,31,30,31,30,31,31,30,31,30,31 }; vector<int> nor = { 31,28,31,30,31,30,31,31,30,31,30,31 };//判断闰年 bool isLeap(int year) { if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) return true; else return false; }//判断那一年一月一号据2000年一月一号的天数 int oneDay(int year) { int days = (year - 2000) / 4 * (365 * 3 + 366); if ((year - 2000) % 4 == 0) return days; else days += 366 + 365 * ((year - 2000) % 4 - 1); return days; } //判断几年几月几号是周几 int judge(int year, int mon, int day) { int days = oneDay(year); if (isLeap(year)) for (int i = 0; i < mon - 1; i++) days = days + leap[i]; else for (int i = 0; i < mon - 1; i++) days = days + nor[i]; days += day - 1; int tmp = days % 7; tmp += 6; if (tmp > 7) return tmp - 7; else return tmp; } void print(int year, int mon, int day) { cout << year << '-'; if (mon >= 10) cout << mon << '-'; else cout << '0' << mon << '-'; if (day >= 10) cout << day << endl; else cout << '0' << day << endl; }void Year(int year) { //元旦 print(year, 1, 1); //马丁 int t = judge(year, 1, 1); if (t == 1) print(year, 1, 15); else { int tmp = 7 - t + 2; tmp += 14; print(year, 1, tmp); } //*** t = judge(year, 2, 1); if (t == 1) print(year, 2, 15); else { int tmp = 7 - t + 2; tmp += 14; print(year, 2, tmp); } //阵亡 t = judge(year, 5, 31); if (t == 1) print(year, 5, 31); else print(year, 5, 31 - t + 1); //国庆 print(year, 7, 4); //劳动 t = judge(year, 9, 1); if (t == 1) print(year, 9, 1); else print(year, 9, 7 - t + 2); //感恩 t = judge(year, 11, 1); if (t <= 4) print(year, 11, 21 + 5 - t); else print(year, 11, 7 - t + 1 + 21 + 3 + 1); //圣诞 print(year, 12, 25); }int main() { int year; while(cin >> year){ Year(year); } return 0; }