0分求调
查看原帖
0分求调
1462752
qianhy_cool楼主2024/10/1 09:12
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, m, a = 0, b = 0, c = 1, d = 2, e = 0;
	cin >> n >> m;
	for (int i = 3; i <= max(n, m); ++i) {
		e = c + d;
		c = d;
		d = e;
		if (i == n)
			a = e;
		if (i == m)
			b = e;
	}
	if (n == 1 && m == 1) {
		cout << 1;
	} else if (n == 1 && m == 2) {
		cout << 2;
	} else if (n == 2 && m == 1) {
		cout << 2;
	} else if (n == 1) {
		cout << b % 10000000;
	} else if (m == 1) {
		cout << a % 10000000;
	} else {
		cout << __gcd(a, b) % 10000000;
	}
}
2024/10/1 09:12
加载中...