2004_1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> using namespace std; int i,j,f,a[9],n=8; int main(){ for (int i = 1; i <=n; i++){ f=i%2; if(f==0)a[i]=0; else a[i]=1; for (int j = 1; j <=i; j++) if(f==0)a[i]=a[i]+j; else a[i]=a[i]*j; } for (int i = 1; i <=n; i++) printf("%5d",a[i]); return 0; } |
0 of 6 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
1、把第06行改为f=i&1;不影响运行结果。( )
2、删除第二行,程序仍然能运行。( )
3、f只有0/1两种取值( )
4、输出为1 3 6 10 120 21 5040 36 ( )
5、程序的时间复杂度为( )
6、该程序可以改造成时间复杂度最少为( )的程序