
[]연산이가능하다면,
deque<int> a;
해놓고,
a[]만쓰면서동적배열로쓸수있는건가요??이배열을포인터로쓸때만 iter가 필요한거고요?
int main()
{
deque<long int> a;
deque<long int>::iterator ai;
long int b,c,d,e=-99999,v;
scanf("%d",&b);
for(c=0;c<b;c++)
{
scanf("%d",&d);
a.push_front(d);
}
for(c=0;c<b-2;c++)
{
v=*(ai+c)+*(ai+c+1)+*(ai+c+2);
if(e<v){e=v;}
}
printf("%d",e);
return 0;
}
//iter 사용
int main()
{
deque<long int> a;
long int b,c,d,e=-99999,v;
scanf("%d",&b);
for(c=0;c<b;c++)
{
scanf("%d",&a[c]);
}
for(c=0;c<b-2;c++)
{
v=a[c]+a[c+1]+a[c+2];
if(e<v){e=v;}
}
printf("%d",e);
return 0;
}
//iter 사용X
왜채점땐 no good이죠..