码迷,mamicode.com
首页 > 编程语言 > 详细

问题 1013: C语言程序设计教程(第三版)课后习题6.3

时间:2017-05-10 21:26:40      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:习题   pen   author   www   cas   int   ons   code   nbsp   

/********************************************************************
@file     Main.cpp
@date     2017-05-10
@author   Zoro_Tiger
@brief    问题 1013: C语言程序设计教程(第三版)课后习题6.3
          http://www.dotcpp.com/oj/problem1013.html
********************************************************************/
#include <cstdio>
#include <cmath>

#define TEST
#undef  TEST

int main(int argc, const char* argv[])
{

#ifdef TEST
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    int n = 0;
    while (scanf("%d", &n) != EOF)
    {
        int sum = 0;
        for (int i = 0; i < n; ++i)
        {
            sum += 2 * static_cast<int>(pow(10.0, i)) * (n - i);
        }
        printf("%d\n", sum);
    }

    return 0;
}

 

问题 1013: C语言程序设计教程(第三版)课后习题6.3

标签:习题   pen   author   www   cas   int   ons   code   nbsp   

原文地址:http://www.cnblogs.com/roronoa-zoro-zrh/p/6838030.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!