Zadatak3.6-automobil

#include <iostream>

using namespace std;

int main()
{
int n,i,s;
cin>>n;

int niz[n];
i=0;

while(i<n)
{cin>>niz[i];
i++;}
s=0;
i=0;
while(i<n-1){
if( niz[i]!=niz[i+1])
s=s+3 ;
if(niz[i]==500 || niz[i]==0 )goto kraj;
i++;}
cout<<s+6<<endl;

return 0;

kraj: cout<<3;
}

Advertisements