2024_3
gorazd
c_cpp
a year ago
506 B
5
Indexable
2kolok_SP
#include <iostream>
#include <cctype>
#include <cstring>
#include <iomanip>
using namespace std;
void sequence(int n, int i, bool descendI)
{
if(n - 5*i <= 0)
descendI = true;
if(descendI and i == 0)
{
cout<<n;
return;
}
if(!descendI)
{
cout<<n-5*i<<" ";
sequence(n, i+1, descendI);
}
else
{
cout<<n-5*i<<" ";
sequence(n, i-1, descendI);
}
}
int main() {
int n;
cin>>n;
sequence(n, 0, false);
}
Editor is loading...
Leave a Comment