A series with same common difference is known as arithmetic series. The first term of series is 'a' and common difference is d. The series looks like a, a + d, a + 2d, a + 3d, . . . Find the sum of series.具有相同共同差异的系列被称为算术系列。系列的第一个术语是“ a ”,共同的区别是d。该系列看起来像a + d,a + 2d,a + 3d。。。找到系列的总和。

Input : a =
        d =
        n =
Output :
 +  +  +  = 

Input : a = 2.5
        d = 1.5
        n =
Output : 

Input:
The first line consists of an integer T i.e number of test cases. The first line and only line of each test case consists of three integers a,d,n.

输入:
第一行由整数T即测试用例数组成。每个测试用例的第一行和第一行由三个整数a,d,n组成。

Output:
Print the sum of the series. With two decimal places.

输出:
打印系列的总和。有两位小数。

Constraints: 
1<=T<=100
1<=a,d,n<=1000

约束: 
1 <= T <= 100 
1 <= a,d,n <= 1000

Example:

Input:

Output:
16.00
335.00

其实,就是一个等差数列的求和问题,不过需要注意的是输出是两位小数。

下面是我的代码实现:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,i,j;
    scanf("%d",&n);
    ;i<n;i++)
    {
        float a,d,n;
        scanf("%f %f %f",&a,&d,&n);
        printf()*d/);
    }
    ;
}

然后竟然出现了错误?一起来看一下:

我试了几次的double类型,也都是这个错误。不是很理解怎么做?这个题目的考察点在哪里哦?

Sum of AP series——AP系列之和的更多相关文章

  1. 深入理解无穷级数和的定义(the sum of the series)

    Given an infinite sequence (a1, a2, a3, ...), a series is informally the form of adding all those te ...

  2. [LeetCode] Sum of Left Leaves 左子叶之和

    Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two l ...

  3. LeetCode 560. Subarray Sum Equals K (子数组之和等于K)

    Given an array of integers and an integer k, you need to find the total number of continuous subarra ...

  4. [LeetCode] Largest Sum of Averages 最大的平均数之和

    We partition a row of numbers A into at most K adjacent (non-empty) groups, then our score is the su ...

  5. [LeetCode] 891. Sum of Subsequence Widths 子序列宽度之和

    Given an array of integers A, consider all non-empty subsequences of A. For any sequence S, let the  ...

  6. [LeetCode] Sum of Two Integers 两数之和

    Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Exam ...

  7. [LeetCode] Maximum Size Subarray Sum Equals k 最大子数组之和为k

    Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If t ...

  8. [LeetCode] Sum of Square Numbers 平方数之和

    Given a non-negative integer c, your task is to decide whether there're two integers a and b such th ...

  9. 404. Sum of Left Leaves 左叶子之和

    [抄题]: Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are ...

随机推荐

  1. 74、django之ajax补充

    之前的ajax使用都是依据jquery来使用的,本篇会先分析ajax的原生的js代码实现,还有jsonp的介绍,与OMR的一些遗漏补充. 本篇导航: js实现的ajax 同源策略与Jsonp 一.js ...

  2. JavaScript(五):函数(闭包,eval)

    1.函数的申明:三种方法: function命令 函数表达式:变量赋值 Function构造函数 //method 1: function命令 function test(){ console.log ...

  3. 使用docker搭建Jenkins 及slave的配置

    安装Jenkins 使用docker docker run -d -p 8080:8080 -p 50000:50000 -v /opt/jenkins_home:/var/jenkins_home ...

  4. POJ3083 Children of the Candy Corn(Bfs + Dfs)

    题意:给一个w*h的迷宫,其中矩阵里面 S是起点,E是终点,“#”不可走,“.”可走,而且,S.E都只会在边界并且,不会在角落,例如(0,0),输出的话,每组数据就输出三个整数,第一个整数,指的是,以 ...

  5. Effective Java 第三版——1. 考虑使用静态工厂方法替代构造方法

    Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...

  6. Java爬虫——模拟登录知乎

    登录界面,首先随意输入一个账号,登录查看发送表单的请求 可以发现请求是Post : https://www.zhihu.com/login/phone_num 发送的表单是 _xsrf: passwo ...

  7. 使用NPOI读取Excel数据到DataTable

    如今XML文件的存储格式大行其道,可是也不是适用于全部情况,非常多单位的数据交换还是使用Excel的形式.这就使得我们须要读取Excel内的数据.载入到程序中进行处理.可是如何有效率的读取,如何使程序 ...

  8. 给eclipse配置sublime主题的背景

    效果例如以下: 步骤: 1.假设你的Eclipse没有Marketplace的话,你自己装一个即可了:Help–>Install New Software–>add location:ht ...

  9. 趋势科技PC-cillin2015,你来公測我发奖!

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaXF1c2hp/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/d ...

  10. 《Javascript_Dom 编程艺术》(第2版)读书笔记

    第1章 Javascript 简史 Dom : 平稳退化.渐进增强,以用户为中心的设计 第2章 Javascript 语法 1.程序设计语言分为:解释性(javascript)和编译型(java,C+ ...