标签:color leetcode ima ctp etc class sum mamicode pre
class Solution { public: int subtractProductAndSum(int n) { int add=0; int prod=1; while(n>0){ int r=n%10; n/=10; prod*=r; add+=r; } int res=prod-add; return res; } };
标签:color leetcode ima ctp etc class sum mamicode pre
原文地址:https://www.cnblogs.com/joelwang/p/12009400.html