Last active
August 25, 2022 00:23
-
-
Save hucancode/14f9deb0db38d2149d5775c71b10deca to your computer and use it in GitHub Desktop.
read a very big number from string and return that number mod 1000000007
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define INF 1000000007 | |
| int read_mod(string num) | |
| { | |
| int ret = 0; | |
| for (auto i = num.begin(); i != num.end(); i++) { | |
| ret = (ret * 10 + (int)(*i) - '0') % INF; | |
| } | |
| return ret; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment