From ranklist I suppose, that exist way to not hard-code 2k-digits automorhic number, but generating it in program. Can anyone help me and tell me how can I do this ? Unfortunatly I got Accepted using hard-coded number. I don't like such way (this is first program in which I made it
![:(](./images/smilies/icon_frown.gif)
- I always want to find way in which I can generate data in program ... ).
If anyone can help me - please send me a hint. I know that I can generate number in such way (but It got TLE):
1. get the number of N digits, for examle 5
2. generate number xN, using following algorithm:
3. try every digit 0..8 for x and calculate sqrt(xN); if sqrt(xN) has the same all digits at the end of xN this is good number and go to 2
If I correct think, this algorithm has time complexity O(NlogN) where N is number of digits.
Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)