blob: b7bbb88b7845634178215a8ea346c7d0acd879c0 [file] [log] [blame]
// { dg-do run }
#include <vector>
std::vector <int>
sequence(int l, int n)
{
std::vector <int> ret;
for(int i=n;i<=100;i++)
{
if(i%2==0)
{
if(l%i==i/2)
{
int init =l/i-i/2+1;
if(init>=0)
{
for(int j=0;j<i;j++)
{
ret.push_back(init);
init ++;
}
break;
}
}
}
else
{
if(l%i==0)
{
int init =l/i-i/2;
if(init>=0)
{
for(int j=0;j<i;j++)
{
ret.push_back(init);
init ++;
}
break;
}
}
}
}
return ret;
}
extern "C" void abort (void);
int main()
{
std::vector<int> res = sequence(18, 2);
if (res.size () != 3
|| res[0] != 5
|| res[1] != 6
|| res[2] != 7)
abort ();
return 0;
}