阅读以下说明和C代码,填补代码中的空缺,将解答填入答题纸的对应栏内。
【说明】
某文本文件中保存了若干个日期数据,格式如下(年/月/日):
2005/12/1
2013/2/29
1997/10/11
1980/5/15
....
但是其中有些日期是非法的,例如2013/2/29是非法日期,闰年(即能被400整除或者能被4整除而不能被100整除的年份)的2月份有29天,2013年不是闰年。现要求将其中自1985/1/1开始、至2010/12/31结束的合法日期挑选出来并输出。
下面的C代码用于完成上述要求。
【C代码】
#include <stdio.h>
typedef struct{
int year, month, day;/* 年,月,日*/
}DATE;
int isLeap Year(int y) /*判断y表示的年份是否为闰年,是则返回1,否则返回0*/
{
return((y%4==0 && y%100!=0)Il(y%400==0));
}
int isLegal(DATE date) /*判断date表示的日期是否合法,是则返回1,否则返回0*/
{
int y=date.year,m= date.month,d=date.day;
if (y<1985 II y>2010 II m<1 II m>12 II d<l II d>31) return 0;
if((m==4 ll m==6 ll m==9 II m==11)&& (1) ) return 0;
If(m==2){
if(isLeap Year(y)&& (2) ) return 1; 。
else
if (d>28) return 0;
}
return 1;
}
Int Lteq(DATE d1,DATE d2)
/*比较日期d1和d2,若d1在d2之前或相同则返回1,否则返回0*/
{
Long t1,t2;
t1=d1.year*10000+d1.month*100+d1.day;
t2=d2.year*10000+d2.month*100+d2.day;
if( (3) ) return 1;
else return 0;
}
int main()
{
DATE date,start={1985,1,1},end={2010,12,30};
FILE*fp;
fp=fopen(“d.txt”,”r”);
If( (4) )
return-1;
while(!feof(fp)){
if(fscanf(fp,”%d%d%d”,&date.year,&date.month,&date.day)!=3)
break;
if( (5) ) /*判断是否为非法日期 */
continue;
if( (6) ) /*调用Lteq判断是否在起至日期之间*/
printf(“%d%d%d\n”,date.year,date.month,date.day);
}
fclose(fp);
Return 0;
}
(1)d>30 或d>=31或其等价表示(2)d<=29或d<30或其等价表示(3)t1<=t2或t1-t2<=0或其等价表示(4)fp==null或!fp或其等价表示(5)!isLegal(date) 或其等价表示(6)Lteq(start,date)==1&&Lteq(date,end)==1或其等价表示
【解析】
(1)(2)理解:if((m==4 ll m==6 llm==9 II m==11)&& d>30 /d>=31) return 0; //如果月份是4,6,9,11并且天数等于31则返回不合法,这几个月最多为30天,不可能大于等于31。If(m==2){ if(isLeap Year(y)&& d<=29 ) return 1;else if (d>28) return 0;//当年份为闰年的时候,那么二月份的天数需小于或等于28。合法则返回1。(3)if( t1<=t2/t1-t2<=0 ) return 1; //d1在d2之前,那么表明日期经换算成t1、t2后,t1<=t2。(4)If( fp==null/!fp )//先要判断文件是否为空;(5)(6)理解: if(!isLegal(date)) /*判断是否为非法日期 */ continue; if(Lteq(start,date)==1&&Lteq(date,end)==1 ) /*调用Lteq判断是否在起至日期之间,Lteq(t1,t2)的含义是比较日期d1和d2,若d1在d2之前或相同则返回1,否则返回0。*/
( )is that it provides guidance and direction on how quality will be managed and verified throughout the project.
( )the process of determining,documenting,and managing stakeholder needs and requirements to meet Project objectives.
The information security management system preserves the confidentiality,integrity and availability of information by applying a( ).
( )is a decentralized database,ensure that the data will not be tampered with and forged.
( )puts computer resources on the web,and must meet the requirements of super capacity,super concurrency,super speed and super security.
分配甲、乙、丙、丁四个人去完成五项任务。每人完成各项任务时间如表所示。由于任务多于人数,故规定其中有一个人可兼完成两项任务,其余三人每人完成一项。为了花费时间最少,( )应该完成两项任务。
已知某公司生产AB两种产品,其中生产1件A产品需要1个单位的甲资源,3个单位的丙资源;生产1件B产品需要2个单位的乙资源和2个单位的丙资源。已知现有甲乙丙三种资源4个单位、12个单位和18个单位。通过市场预测,可知A产品的单位市场利润为2元,B产品的单位市场利润为5元。该公司获得最大的市场利润应生产A产品(68)件,此时(69)资源仍有剩余。
已知某公司生产AB两种产品,其中生产1件A产品需要1个单位的甲资源,3个单位的丙资源;生产1件B产品需要2个单位的乙资源和2个单位的丙资源。已知现有甲乙丙三种资源4个单位、12个单位和18个单位。通过市场预测,可知A产品的单位市场利润为2元,B产品的单位市场利润为5元。该公司获得最大的市场利润应生产A产品(68)件,此时(69)资源仍有剩余。
某项目2016年投资额12万元,2018年开始取得项目的净收益(产品一原料辅料及公用工程)6万元/年,2018-2021年每年还会产生其他成本(包括人员工资、管理成本、制造成本等)1.1万元/年;増值税0.35万元/年、营业税金及附加0.05万元/年。则该项目的静态投资回收期为(66)年,截止到2021年底该项目的投资收益率是(67)。
安全审计的手段主要包括( )。