Witajcie, do zadania http://pl.spoj.com/problems/PP0601A2/ wykonałem taki program, lecz mi go nie zalicza, ktoś potrafi mi powiedzieć, czemu? Sprawdzałem już wiele wariantów...
#include <iostream>
using namespace std;
int main()
{
int test, last=-1, last2=-1, it=0;
while(true)
{
cin >> test;
if(test == 42)
++it;
if((test == 42 && last == 42) || test != 42 && last == 42 && last2 == 42)
--it;
last2 = last;
last = test;
cout << test << endl;
if(it == 3)
return 0;
}
}