题意:
输入一个正整数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. [转]触发fullgc的条件

    良好的状态是:minor gc比较多 full gc 比较少 因为fullgc时间比较慢,而且会占用CPU的时间片. 不好的状态是:minor gc比较少 full gc 比较多 这样程序就一直卡在f ...

  2. flask入门(四)

    数据库 flask在数据库这一块有一个扩展应用叫做flask-sqlalchemy,去虚拟环境里pip install一下,如下 我这边用的是mysql,指定的url是这个mysql://userna ...

  3. 虚拟磁盘VHD文件压缩方法

    问题描述 因工作需要在Mac上跑了一个VirtualBox虚拟win7,使用对win系统友好的vhd格式作为虚拟硬盘.经过一段时间使用发现vhd占用空间远大于虚拟磁盘使用量,想办法减减肥才行. 步骤整 ...

  4. [JZOJ5060] 公路建设

    题目描述 在Byteland一共有n个城市,编号依次为1到n,它们之间计划修建m条双向道路,其中修建第i条道路的费用为ci. Byteasar作为Byteland公路建设项目的总工程师,他决定选定一个 ...

  5. 3ds Max File Format (Part 4: The first useful data; Scene, AppData, Animatable)

    The most interesting part of this file is, evidently, the Scene. Opening it up in the chunk parser, ...

  6. 巨杉Tech | SparkSQL+SequoiaDB 性能调优策略

    当今时代,企业数据越发膨胀.数据是企业的价值,但数据处理也是一种技术挑战.在海量数据处理的场景,即使单机计算能力再强,也无法满足日益增长的数据处理需求.所以,分布式才是解决该类问题的根本解决方案.而在 ...

  7. python tkinter模版

    import tkinter import time import threading from tkinter import ttk event = threading.Event() once=0 ...

  8. D0 设计模式

    单一职责 一个类只负责一个功能领域中的相应职责.,就一个类而言,应该只有一个引起它变化的原因. 单一职责原则告诉我们: 一个类不能太"累"! 在软件系统中, 一个类( 大到模块, ...

  9. 高端OLED电视成行业突破口,苏宁助力显示技术市场迭代

    编辑 | 于斌 出品 | 于见(mpyujian) 在电商与线上渠道越来越占据举足轻重地位的年代,电商平台巨头们越来越有底气喊出"推动行业技术升级"的口号.的确,再好的技术升级也需 ...

  10. 显示目录文件命令 - ls

    1) 命令名称:ls 2) 英文原意:list 3) 命令所在路径:/bin/ls 4) 执行权限:所有用户 5) 功能描述:显示目录文件 6) 语法: ls 选项[-ald][文件或目录] -a 显 ...