题意:
输入一个正整数N(<=1e5),接着输入N个小于等于1.0的正数,输出N个数中所有序列的和。

AAAAAccepted code:

 #define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
double a[];
int main(){
//ios::sync_with_stdio(false);
//cin.tie(NULL);
//cout.tie(NULL);
int n;
scanf("%d",&n);
double sum=;
for(int i=;i<=n;++i){
scanf("%lf",&a[i]);
sum+=a[i]*i*(n-i+);
}
printf("%.2lf",sum);
return ;
}

【PAT甲级】1104 Sum of Number Segments (20 分)的更多相关文章

  1. PAT 甲级 1104. Sum of Number Segments (20) 【数学】

    题目链接 https://www.patest.cn/contests/pat-a-practise/1104 思路 最容易想到的一个思路就是 遍历一下所有组合 加一遍 但 时间复杂度 太大 会超时 ...

  2. PAT甲级——1104 Sum of Number Segments (数学规律、自动转型)

    本文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90486252 1104 Sum of Number Segmen ...

  3. PAT 甲级 1104 sum of Number Segments

    1104. Sum of Number Segments (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CAO, Pen ...

  4. PAT甲级——A1104 Sum of Number Segments【20】

    Consider a positive integer N written in standard notation with k+1 digits a​i​​ as a​k​​⋯a​1​​a​0​​ ...

  5. PAT (Advanced Level) 1104. Sum of Number Segments (20)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  6. PAT甲题题解-1104. Sum of Number Segments (20)-(水题)

    #include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...

  7. PAT甲级——A1104 Sum of Number Segments

    Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For exam ...

  8. PAT Advanced A1104 Sum of Number Segments (20) [数学问题]

    题目 Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For e ...

  9. PAT甲级:1136 A Delayed Palindrome (20分)

    PAT甲级:1136 A Delayed Palindrome (20分) 题干 Look-and-say sequence is a sequence of integers as the foll ...

随机推荐

  1. 记录 Docker 的学习过程 (网络篇之跨主机互通)

    下面从node3上操作node3# docker run -d -p 8500:8500 --name consul progrium/consul -server -bootstrap node3# ...

  2. Selenium3+python自动化011-unittest生成测试报告(HTMLTestRunner)

    批量执行完用例后,生成的测试报告是文本形式的,不够直观,为了更好的展示测试报告,最好是生成HTML格式的. unittest里面是不能生成html格式报告的,需要导入一个第三方的模块:HTMLTest ...

  3. TF file

    To software:Design rules for placement and routing interconnect resistance /capacitance data for gen ...

  4. docker远程访问

    查看版本 docker version 查看信息 docker info 修改配置文件 ubuntu在 /etc/default/docker centos在/usr/lib/systemd/syst ...

  5. python爬虫匹配实现步骤

    import requests,re url='https://movie.douban.com/top250' urlcontent=requests.get(url).text #正则 ''' 实 ...

  6. 关于wget安装mysql的过程

    鄙人才疏学浅,写此文章是为了帮助我那些刚入门的朋友一点心意 第一步  安装yum源 安装mysql的yum源:wget https://dev.mysql.com/get/mysql80-commun ...

  7. 【Python】字符串处理函数

  8. HDU 2586 ( LCA/tarjan算法模板)

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=2586 题意:n个村庄构成一棵无根树,q次询问,求任意两个村庄之间的最短距离 思路:求出两个村庄的LCA,d ...

  9. .NET知识梳理——3.面向对象

    1. 面向对象 1.1        封装.继承.多态理解 1.1.1  封装 封装就是将抽象得到的数据和行为(或功能)相结合,形成一个有机的整体,也就是将数据与操作数据的源代码进行有机的结合,形成“ ...

  10. mysql之case..when ..then..else..end as..用法

    1.示例1 查询1: SELECT CASE main_xm_sam31 WHEN '02' THEN 2 ELSE 1 END AS SPDJ FROM SR_MAIN_BG A WHERE A.P ...