HDOJ1002 A+B Problem II Wrong Answer. 代码如下:
1 #include2 3 using namespace std; 4 5 6 int main() 7 { 8 int n; 9 while(cin>>n &&n)10 {11 int *a = new int[n];12 int sumRun=0,sumStop=0,sumTotal=0;13 int i=0;14 a[0]=0;15 for (i=1;i<=n;i++)16 {17 cin>>a[i];18 if (a[i]>a[i-1]) {19 sumRun = sumRun + ((a[i]-a[i-1])*6);20 }21 else if (a[i]