题意:
输入一个正整数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. 我的翻译--GSMem:通过GSM频率从被物理隔离的计算机上窃取数据

    抽象概念 AG网络是指在物理上与公共互联网断开的网络.虽然近几年人们验证了入侵这类网络系统的可行性,但是从这种网络上获取数据仍然是一个有挑战的任务.在本文中,我们介绍GSMem,它是一个可以在蜂窝数据 ...

  2. 番外:可刷新PDB的管理操作(如何切换PDB Switching Over)

    基于版本:19c (12.2.0.3) AskScuti 主题:可刷新PDB如何进行切换操作 内容说明:本篇延续如何克隆可刷新的PDB(Refreshable PDB)一文,进行切换实验. 具体请参考 ...

  3. nginx配置https域名

    nginx安装配置支持https和配置https域名 yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-de ...

  4. SpringBoot整合WEB开发--(五)自定义错误页

    目的与原理: 处理异常时,若我们想根据实际情况返回不同的页面,@ControllerAdvice与@ExceptionHandler,一般用于处理应用级别的异常,一些容器级别的错误就处理不了,例如Fi ...

  5. mysql行级锁 select for update

    mysql行级锁 select for update 1.属于行级锁 2.where条件后需要写出明确的索引条件(如果有多个条件,可以建立联合索引) 3.如果其所在的事务提交或者回滚后,或者更新该条数 ...

  6. yii2验证规则

    验证规则 1.内置验证规则 [['sex', 'partner_id'], 'integer'], [['partner_id', 'camp_id',], 'required'], [['creat ...

  7. 在vue中使用swiper4.x

    需求 :实现一个左右两边有边距的轮播图vue+swiper4 轮播图左右两边含有上一张和下一张的一部分 先安装swiper: 1.npm install swiper 安装swiper   2.在入口 ...

  8. Codeforces Round #600 (Div. 2) D。 Harmonious Graph

    #include<iostream> using namespace std ; ; int p[N]; int cnt; int find(int x) { if(p[x]!=x) p[ ...

  9. 【C语言】输入一个整数x并判断x是否存在于数组a中

    #include<stdio.h> int main() { ] = { ,,,,,,,, };//数组初始化 printf("请输入要查找的数据:\n"); scan ...

  10. DoS攻击种类

    DoS攻击有许多种类,主要有Land攻击.死亡之ping.泪滴.Smurf攻击及SYN洪水等. 据统计,在所有黑客攻击事件中,syn洪水攻击是最常见又最容易被利用的一种DoS攻击手法. 1.攻击原理 ...