本文最后更新于 1163 天前,其中的信息可能已经有所发展或是发生改变。
代码语言:javascript复制#include<iostream>
using namespace std;
int judge(int y){
int flag;
if(y@0==0){
flag=1;
}
else if(y0==0){
flag=0;
}
else if(y%4==0){
flag=1;
}
else{
flag=0;
}
return flag;
}
int swapW(int flag,int y,int m,int d){
int s[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int s1[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int sum=d;
for(int i=1599;i<y;i ){
if(judge(i)){
sum =366;
}
else{
sum =365;
}
}
if(flag){
for(int i=0;i<m-1;i ){
sum =s1[i];
}
return sum%7;
}else{
for(int i=0;i<m-1;i ){
sum =s[i];
}
return sum%7;
}
}
int main(){
int flag,y,m,d;
cin>>y>>m>>d;
flag=judge(y);
int aw=(swapW(flag,y,m,d) 4)%7;
if(aw==0){
aw=7;
}
cout<<aw;
return 0;
}
Post Views: 220