Răspuns:
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("numerus.in");
ofstream g("numerus.out");
int n, k, line;
char ch='A';
int main()
{
f >> k >> n;
line=n/5;
if (n%5) ++line;
if (k%2)
{
int p=(k-1)*5+1;
for (int i=1; i<=5; i++)
g << p++ << " ";
g << --p;
}
else
{
int p=5*k;
g << p << " ";
for (int i=2; i<=6; i++)
g << p-- << " ";
}
g << endl;
g << line << endl;
if (n%5==0)
{
if (n%2) g << 'E' << " " << 'F';
else g << 'A' << " " << 'B';
}
else
{
int c=n/5;
if (c%2==0)
{
int r=n%5;
ch=ch+(r-1);
g << ch;
}
else
{
int r=n%5;
ch=ch+(6-r);
g << ch;
}
}
}
Explicație:
daca apar neclaritati... eu sunt aici :)))
dar sper sa te descurci singur, daca cercetezi asa probleme... Succese!