1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <iostream> #include <cstdio> #include <cmath> using namespace std; int s,maxx; int a[11]; int main(){ for (int i =1; i <=10; i++)cin>>a[i]; maxx=a[1]; s=a[1];; for (int i = 2; i <=10; i++){ if(s<0)s=0; s=s+a[i]; if(s>maxx)maxx=s; } printf("%d",maxx); return 0; } |
0 of 4 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:
0 of 4 Questions answered correctly
Your time:
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、将03行删除,程序也能得到正确的结果。( )
2、将13行”<“改为”<=”程序也能得到正确的结果( )
输入为”8 9 -1 24 6 5 11 15 -28 9″时,输出为( )
将13行删除,按第3题的输入,则输出为( )