c语言面试题目100及最佳答案(c语言面试算法题)

 2021-11-17 11:47    77  

  呵呵鐵猴子傳奇之怒火狼牙c语言面试题目100及最佳答案。刚好做过的。
  
#include
#define leap(n) (((n%4==0&&n0!=0)||(n@0==0))?1:0)
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
char str[][10]={"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"};
void solve(int &s,int start,int end,int st,int pt)
{
int i;
for(i=start;i {
if(leap(i)) s =366;
else s =365;
}
for(i=st;i
=1900)
{
s=1;
solve(s,1900,year,1,month);
s=(s day-1)%7;
if(s==0) s=7;
}
else
{
s=0;
solve(s,year 1,1900,month 1,13);
s=(s a[month-1]-day)%7;
s=7-s;
}
printf("%s

",str[s-1]);
}
return 0;
}c语言面试题目100及最佳答案。

本文标签:

原文链接:https://www.xgfox.com/dmfx/34174.html

本文版权:如无特别标注,本站文章均为原创。