Skip to content

Instantly share code, notes, and snippets.

@hucancode
Last active August 25, 2022 00:23
Show Gist options
  • Save hucancode/14f9deb0db38d2149d5775c71b10deca to your computer and use it in GitHub Desktop.
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
#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