1281.cpp 275 B

1234567891011121314
  1. class Q1281 {
  2. public:
  3. int subtractProductAndSum(int n) {
  4. int plus = 0;
  5. int mult = 1;
  6. while (n) {
  7. int quo = n % 10;
  8. n = n / 10;
  9. plus += quo;
  10. mult *= quo;
  11. }
  12. return mult - plus;
  13. }
  14. };
备用站点 当前处于降级运行的备用站点,仅供应急访问,数据和功能可能不是最新。