, I don't understand。
2018-02-04 23:30
, I don't understand。
2018-02-04 23:31
程序代码:#include <iostream>
int foo(int i)
{
int n = 0;
if (1 == i) n = 1;
else n = foo(i - 1) + 3 * (i - 1);
std::cout << n << " ";
return n;
}
int Nprint(int n)
{
unsigned int i = 1;
unsigned int N = n - 1;
while (i < 2*n)
{
if (i <= n) std::cout << i << " ";
else std::cout << N-- << " ";
i++;
}
return 0;
}
int main()
{
int i = 0;
std::cout<<"这是第一道题的测试用例,输入一个数字,将输出一个数列,现在输入吧,一个数字:";
std::cin >> i;
foo(i);
std::cout << std::endl;
int n = 0;
std::cout << "这是第二道题的测试用例,输入一个数字,将输出另一个数列,你说的更糟的那个,是在等你输入这个用例的数字,现在输入吧,一个数字:";
std:: cin >> n;
Nprint(n);
std::cout << std::endl;
return 0;
}
2018-02-04 23:39
2018-02-04 23:39



2018-02-05 10:51




2018-02-05 21:09
2018-02-06 09:57
2018-02-10 22:21
2018-02-10 22:22
2018-02-10 22:23