马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
这是题目:
正确答案应该是8879000但是我的不对
我的代码如下:#include <stdio.h>
int Month[13] = {0, 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int runnian(int years){
if(years%400==0 || (years%4==0 && years%100!=0)){
Month[2]=29;
}else{
Month[2]=28;
}
return 0;
}
int runmi(int day,int wek){
if(day==1&&wek==1){
return 2000;
}else
if(day==1&&wek!=1){
return 2000;
}else
if(day!=1&&wek==1){
return 2000;
}else
return 1000;
}
int main(void){
int year=2000;
int month=1;
int day=1;
int wek=6;
int summi=2000;
while(year!=2000||month!=10||day!=1){
runnian(year);
day++;
wek=(wek+1)%7;
if(day>Month[month]){
day=1;
month++;
if(month>12){
month=1;
year++;
}
}
summi=summi+runmi(day,wek);
}
printf("%d",summi);
return 0;
}
有些粗心了,题目不是说到2020-10-1号结束吗?
那结束条件就是while(year!=2020 || month!=10 || day!=1)啊
|