I don't understand why im getting sigabrt error in this code for spoj question https://pl.spoj.com/problems/OSTSIL/ please show me what im doing wrong.
i cant use any external libraries because it's spoj problem I have very basic understanding what heap and stack is (i'm in second grade of high school so please keep it simple)
#include<iostream>
using namespace std;
int main()
{
short tests;
cin >> tests;
if (tests > 1000)
return 0;
int *outputs = new int[tests];
short buffer = tests;
for (tests; tests > 0; tests--)
{
short j = 0, output = 1;
short i = 1;
short n;
cin >> n;
for (i; i <= n; i++)
{
output *= i;
while (output % 10 == 0)
{
output /= 10;
}
do
{
output--;
j++;
} while (output % 10 != 0);
output = j; j = 0;
}
outputs[tests] = output;
}
for (buffer; buffer > 0; buffer--)
cout << outputs[buffer] << endl;
delete[] outputs;
return 0;
}