Skip to content

Instantly share code, notes, and snippets.

@Privilger
Last active February 18, 2020 15:09
Show Gist options
  • Save Privilger/641299cee11eaf603e6c1996f4af606c to your computer and use it in GitHub Desktop.
Save Privilger/641299cee11eaf603e6c1996f4af606c to your computer and use it in GitHub Desktop.
C++大数运算去除前导0
/*
C++大数运算去除前导0
vector<int> c; // c的数据类型
如果要用c表示一个大数, eg: "123456"
则存储方式为(倒着存):
[6, 5, 4, 3, 2, 1]
*/
while(c.size() > 1 && c.back() == 0) {c.pop_back();}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment