问题 问答题

【程序功能】在给定范围内查找k使得用公式k^2+k+17生成的整数满足以下条件:该数的十进制表示中低3位数字相同,去掉低3位后的整数是回文数。例如,当k=461时用公式生成的整数是212999,该数满足所给条件。 【编程要求】1.编写函数int findnum(int n1,int n2,long a[][2])实现以下功能:k依次取n1~n2范围内的每个整数,分别用每个k及公式k2+k+17生成整数y,若y满足给定条件,则将k值及y值保存到a指向的数组中,函数返回a数组中k的个数。2.编写函数main实现以下功能:声明二维数组a和变量n1、n2,输入两个整数并保存到n1、n2中,用n1、n2及a数组作实参调用findnum函数,按所给格式输出a数组中的数据到屏幕及文件myf2.out中。最后将考生本人的准考证号输出到文件myf2.out中。【测试数据与运行结果】输入:n1=1,n2=10000输出:knumber 461212999 586343999 383914741777【要求】1.源程序文件名为myf2.c,输出结果文件名为myf2.out。2.数据文件的打开、使用、关闭均用c语言标准库中缓冲文件系统的文件操作函数实现。3.源程序文件和运行结果文件均需保存在T:盘根目录中供阅卷使用。4.不要复制扩展名为obj和exe的文件到T:盘中。

答案

参考答案:

 #include int findnum(int nA,int nB,long a[][B]) { int i=0,j; long xA,xB,xC,y,k; for(k=nA;k<=nB;k++) {y=k*k+k+AG; xA=xB=y/A000;xC=0; while(xA>0) {xC=xC*A0+xA%A0;xA=xA/A0;} if(xB==xC&&y%A0==y/A0%A0&&y%A0==y/A00%A0) { a[i][0]=k;a[i++][A]=y; } } return i; } main() {int i,j;long a[A0][B],nA,nB; FILE *fp; fp=fopen("MyfB.out","w"); scanf("%d%d",&nA,&nB); j=findnum(nA,nB,a); printf("\n k\t number"); for(i=0;i

单项选择题
单项选择题

Most people would be (1) by the high quality of medicine (2) to most Americans. There is a lot of specialization, a great deal of (3) to the individual, a (4) amount of advanced technical equipment, and (5) effort not to make mistakes because of the financial risk which doctors and hospitals must (6) in the courts if they (7) things badly.

But the Americans are in a mess. The problem is the way in (8) health care is organized and (9) . (10) to pubic belief it is not just a free competition system. The private system has been joined a large public system, because private care was simply not (11) the less fortunate and the elderly.

But even with this huge public part of the system, (12) this year will eat up 84.5 billion dollars—more than 10 percent of the U. S. Budget—large number of Americans are left (13) . These include about half the 11 million unemployed and those who fail to meet the strict limits (14) income fixed by a government trying to make savings where it can.

The basic problem, however, is that there is no central control (15) the health system. There is no (16) to what doctors and hospitals charge for their services, other than what the public is able to pay. The number of doctors has shot up and prices have climbed. When faced with toothache, a sick child, or a heart attack, all the unfortunate persons concerned can do is (17) up. Two thirds of the population (18) covered by medical insurance. Doctors charge as much as they want (19) that the insurance company will pay the bill.

The rising cost of medicine in the U. S. A. is among the most worrying problems facing the country. In 1981 the country’s health bill climbed 15.9 percent--about twice as fast as prices (20) general.

3()

A.extension

B.retention

C.attention

D.exertion