题目链接:http://acm.henu.edu.cn/contest/problem?id=2&pid=2
#include <bits/stdc++.h>
using namespace std;
#define LL long long
int main()
{
LL a, b, n;
while (cin >> a >> b >> n)
{
LL x = a, y = 1;
for (int i = 2; i <= n; i++)
{
LL prex = x, prey = y;
x = a * prex + b * prey;
y = prex + a * prey;
}
cout << x << " " << y << endl;
}
return 0;
}
本文详细解析了一个ACM竞赛中的序列生成题目,通过使用C++实现双序列的递推算法,展示了如何根据给定的初始值和迭代次数生成特定的数列。代码中包含了标准输入输出操作,适合于理解ACM竞赛中常见的数学问题和编程技巧。
7590

被折叠的 条评论
为什么被折叠?



