网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
下面程序的时间复杂度为O() p = a[0] power = 1 for i = 1 to n do power = power * x p = p + a[i] * power return p
参考答案和解析
n
更多 “下面程序的时间复杂度为O() p = a[0] power = 1 for i = 1 to n do power = power * x p = p + a[i] * power return p” 相关考题
考题
(34)为计算 a 的值,某人编写了函数 power 如下:Private Function power (a As Integer, n As Integer) As LongDim p As Longp=aFor k=1 To np=p*aNext kpower=pEnd Function在调试时发现是错误的,例如 Print power(5,4)的输出应该是 625,但实际输出是 3125。程序需要修改。下面的修改方案中有 3 个是正确的,错误的一个是( )。A)把 For k=1 To n 改为 For k=2 To nB)把 p=p*a 改为 p=p^nC)把 For k=1 To n 改为 For k=1 To n-1D)把 p=a 改为 p=1
考题
下列等式成立的有()。
A.(F/A,i,n)=(P/F,i,n)X(A/P,i,n)B.(P/F,i,n)=(A/F,i,n)×(P/A,i,n)C.(A/P,i,n)=(F/P,i,n)×(A/F,i,n)D.(A/P,i,n)=(P/F,i,n1)×(A/F,i,n2),n1+n2=nE.(A/F,i,n)=(P/F,i,n)X(A/P,i,n)
考题
假如整数数列中的数不重复,并存放在数组中。下列给定的程序中,函数fun()的功能是:删除数列中值为X的元素。 N中存放的是数列中元素的个数。请改正程序中的错误,使它能够得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include<stdio.h>define N 20fun (int *a,int n,int x){int p=0,i;a[n]=x;while (x!=a[p])p=p+1;if(p==n) return -1;else{for (i=p;i<n;i++)/*************found**************/a[i+1]=a[i];return n-1;}}main(){int w[N]={-3,0,1,5,7,99,10,15,30,90},x,n,i;n=10;printf("The original data :\n");for (i=0;i<n;i++) printf("%5d",w[i]);printf("\nInput x (to delete ): ");scanf("%d",x);printf("Delete : %d\n",x);n=fun(w,n,x);if (n==-1) printf("***No be found!***\n\n");else{printf("The data after deleted:\n");for (i=0;i<n;i++) printf("%5d",w[i]);printf("\n\n");}}
考题
为计算a“的值,某人编写了函数power如下:Private Function power(a As Integer,n As Integer)As LongDim P As LongP=aFor k=l T0 nP=P * aNext kpoWer=PEnd Function在调试时发现是错误的,例如Print power(5,4)的输出应该是625,但实际输出是3125。程序需要修改。下面的修改方案中有3个是正确的,错误的一个是A.把For k=1 To n改为For k=2 To nB.把P=P*a改为P=p^nC.把Fork=1 To n改为For k=1 To n-1D.把P=a改为P=1
考题
有以下程序fun(int *a,int n) { int i,j=0,p; p=j; for(i=j;in;i++) if(a[i]a[p]) ____; return(p);}在下画线处应填入的是A.i=p B.a[p]=a[i] C.p=j D.p=i
考题
有以下程序:includevoid f(char p[][10],int n){char t[10];int i,j;for(i=0;i
有以下程序: #include<string.h> void f(char p[][10],int n) {char t[10];int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strcmp(p[i],p[j])>0) {strcpy(t,p[i]);strcpy(p[i],p[j]);strcpy(p[j],t);} } main() {char p[5][10]={"abc","aabdfg","abbd","dedbe","cd"}; f(p,5); printf("%d\n",strlen(p[0]));} 程序运行后的输出结果是( )。A.2B.4C.6D.3
考题
请将下面程序补充完整。public class PowerCalc{public static void main(String[]args){double x=5.0;System. out. println(x+"to the power 4 is"+power(x, 4));System. out. println("7. 5 to the power 5 is"+power(7.5, 5));System. out. println("7.5 to the power 0 is"+power(7.5, 0));System. out. println("10 to the power -2 is"+power(10, -2));}static double【 】 (double x, int n){if(n>1)return x * power(x, n-1);else if(n<0)return 1.0/power(x, -n);elsereturn n==0 ? 1.0:x;}}
考题
有以下程序:main(){ int a[3][3],*p,i;p=a[0][0];for(i=0;i<9;i++)p[i]=i+1;printf("%d\n",a[1][2]);}程序运行后的输出结果是【 】。
考题
下列程序的输出结果是( )。 #includestdio.h main { int a[2][3]={{1,2,3),{4,5,6)),(*p)[3],i; p=a ; for(i=0;i3;i++) { if(i2) p[1][i]=p[1][i]-1; else p[1][i]=1; } printf("%d\n",a[o][1]+a[1][1]+a[1][2]); }A.8B.7C.12D.9
考题
有以下程序 fun(char p[][10]) {int n=0,i; for(i=O;i<7;i++) if(p[i][O]=T)n++; return n; } main() {char str[][10]={"Mon","Tue","Wed","Thu","Fri", "Sat","Sun"}; printf("%d\n",fun(str)); }A.1B.2C.3D.0
考题
有以下程序:include fun( char p[] [10]){int n=0,i; for(i=0;i
有以下程序:#include <stdio.h>fun( char p[] [10]){ int n=0,i; for(i=0;i<7;i ++) if(p[i][0] =='T') n++; return n;}main( ){ char sir[] [10] = { "Mon" ,"Tue" ,"Wed" ,"Thu" ,"Fri" ,"Sat" ,"Sun" }; prlnff(" % d\n" ,fun(str) );}程序执行后的输出结果是( )。A.1B.2C.3D.0
考题
执行下列程序: CLEAR SET TALK OFF STORE 1 TO i,a,b DO WHILE i<=3 DO PROG1 ??"P("+STR(i,1)+")="+STR(a,2)+"," i=i+1 ENDDO ??"b="+STR(b,2) RETURN PROCEDURE PROGl a=a*2 b=b+a SET TALK ON RETURN 程序的运行结果为A.P(1)=2,P(2)=3,P(3)=4,b=15B.P(1)=2,P(2)=4,P(3)=6,b=8C.P(1)=2,P(2)=4,P(3)=6,b=18D.P(1)=2,P(2)=4,P(3)=8,b=15
考题
下面程序的输出结果是( )。 main() { int i=1,p; p=f(i,++i); printf("%d",p); } int f(int a, int b) { int C; if(a>b) C=1; else if(a==b)C=0; else C==-1; return (C); }A.-1B.0C.1D.2
考题
有以下程序:includemain() {int a[3][3],*p,i; p=a[0][0]; for(i=0;i
有以下程序: #include <stdio.h> main() { int a[3][3],*p,i; p=a[0][0]; for(i=0;i<9;i++) p[i]=i+1; printf("%d\n",a[1][2]); } 程序运行后的输出结果是( )。A.3B.6C.9D.2
考题
下面程序的功能是()。include include using namespace std;int main (){ in
下面程序的功能是( )。 #include <iostream> #include <string> using namespace std; int main () { int i=1, n=0; char s[80],*p; p=s; strcpy(p,"It is a book.."); for (; *p !=' \0' ;p++) { if(*p=='') i=0; else if (i==0) { n++; i=1; } } cout<<"n=" <<n<<end1; return 0; }A.统计字符串中的单词个数B.统计字符串中的空格个数C.统计字符串中的字母个数D.统计字符串中的全部字符个数
考题
1986年,美国著名市场营销学家菲利浦?科特勒教授在原4P组合的基础上提出了6P营销策略,增加的两个P为( )。A.权力(Power)、渠道(Place)
B.权力(Power)、公共关系(Pub1icRelations)
C.促销(Promotion)、权力(Power)
D.渠道(Place)、公共关系(PublicRelations)
考题
有关IBM POWER 710 服务器,下面的哪些说法是合理的()A、Power 710是IBM System p 服务器一款入门级产品,可配置4核、6核、8核CPUB、Power 710采用power7芯片,支持3.0GHz,3.7GHz,3.55GHz主频C、Power 710支持AIX,LINUX,IBM i操作系统D、以上都正确
考题
A customer wants to take advantage of IBM’s Micro-Partitioning capabilities for their new AIX applications. The pSeries technical specialist should recommend purchasing which of the following?()A、p5 hardware, AIX 5.2, Virtual I/O ServerB、POWER4 hardware, AIX 5.3, Virtual I/O Server,C、p5 hardware, AIX 5.3, Advanced POWER Virtualization featureD、POWER4 hardware, AIX 5.2, Advanced POWER Virtualization feature
考题
Companycom currently has three p650 servers in their environment and they are implementing a p5 595. The p650 servers are running in an SMP environment, but are connected to a pair of HMCs. In order to follow best practices in the enterprise server environment and maintain HMC connectivity to the p650s, what else will needs to be ordered in addition to the p5 595?()A、Include a new HMC in the order to connect to the p5 595B、Include a pair of new HMCs in the order to connect to the p5 595C、Include a media set for POWER5 HMC in the order to upgrade one of the existing HMC’s to POWER5 capabilitiesD、Include a media set for POWER5 HMC in the order to upgrade both of the existing HMC to POWER5 capabilities Include a media set for POWER5 HMC in the order to upgrade both of the existing HMC? To POWER5 capabilities
考题
有关IBM POWER 520 服务器,下面的哪些说法是合理的()A、p520 是IBM POWER Systems 服务器一款入门级产品,可配置1核、2核、4核CPUB、p520 采用power6芯片,支持4.2GHz主频C、p520 支持AIX,LINUX操作系统D、以上都正确
考题
1986年,美国著名市场营销学家菲利浦·科特勒教授在原4P组合的基础上提出了6P营销策略,增加的两个P为()。A、权力(Power)、渠道(Place)B、权力(Power)、公共关系(PublicRelations)C、促销(Promotion)、权力(Power)D、渠道(Place)、公共关系(PublicRelations)
考题
多选题已知从第0年到第n年,每年年值为A,利率为i,期限为n,则现值P为()。AA+A(P/A,i,n)BA(P/A,i,n+1)CA(P/A,i,n+1)(F/P,i,1)DA(F/A,i,n+1)(P/F,i,n)EA(F/A,i,n)(P/F,i,n)
热门标签
最新试卷