int foo(int n)
{
    if (n < 1){
        return 0;
    }
    
    int result = 0;
    for(int i = 1, factor = 1; i <= n; (factor += (pow(10.0, i))), ++i){
        result += (i * factor);
    }
    return result;
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2021-09-09
  • 2021-07-15
  • 2022-12-23
  • 2021-09-14
猜你喜欢
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2021-06-22
  • 2022-12-23
相关资源
相似解决方案