4

How to know if a number N is divisible by k ? ( N <= 10^5000000) ?

 1 year ago
source link: https://codeforces.com/blog/entry/96108
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Um, hi ... ? Basically we have a number N (N <= 10^5000000) represented by a string. Let say that |N] = the length of string N. Now I'm given an integer k (k <= 1e9). How do I confirm that N is divisible by k in O(|N|) ??

P/S : Notice that I want solution that works in O(|N|), not O(|N|log5000000). Anyone can help me ?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK