【进制】计算B进制(秦九韶算法)
计算B进制的值(秦九韶算法)
#include <iostream>
#include <cstring>
using namespace std;
typedef long long LL;
LL get()
{
LL res = 0;
int n, b;
cin >> n >> b;
while (n -- )
{
int x;
cin >> x;
res = res * b + x; // 用res表示当前的值(同时也可表示上一位的值)
}
return res;
}
int main()
{
LL res1 = get(), res2 = get();
if (res1 > res2) cout << ">" << endl;
else if (res1 < res2) cout << "<" << endl;
else cout << "=" << endl;
return 0;
}