code1的SPOJ - 解决不了的 [英] CODE1 at SPOJ - cannot solve it
问题描述
我试图解决这个问题的揭秘code 的上 SPOJ < /一>,这显然是一个数学问题。
I am trying to solve the problem Secret Code on SPOJ, and it's obviously a math problem.
对于那些谁懒得去阅读,是这样的:
For those who are lazy to go and read, it's like this:
a0, a1, a2, ..., an - sequence of N numbers
B - a Complex Number (has both real and imaginary components)
X = a0 + a1*B + a2*(B^2) + a3*(B^3) + ... + an*(B^n)
所以,如果你给B和X,你应该找到A0,A1,..an。 我不知道如何或在哪里开始,因为连N已知,只是X和B点。
So if you are given B and X, you should find a0, a1, ..an. I don't know how or where to start, because not even N is known, just X and B.
的问题并不像前pressing若干在碱乙一样容易,因为B是复数。
The problem is not as easy as expressing a number in a base B, because B is a complex number.
怎样才可以解决呢?
推荐答案
关键是, A0 ..一个
不是任意的数字,他们的整数的(否则,这将是不可能的总称)。你给出的数字 X
,并要求前preSS它基地 B
。你为什么不通过努力的几个例子 B
?
The key is that a0 .. an
are not arbitrary numbers, they're integers (otherwise, this wouldn't be possible in general). You're given the number X
, and are asked to express it in base B
. Why don't you start by working a few examples for a specific value of B
?
如果我问你写17日在基地2个,你就可以做到这一点?你能找到一种方法来概括您使用比2碱基的其他算法?
If I asked you to write 17 in base 2, would you be able to do that? Can you find a way to generalize the algorithm you use to bases other than 2?
这篇关于code1的SPOJ - 解决不了的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!