【PAT甲级】1104 Sum of Number Segments (20 分)
题意:
输入一个正整数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 分)的更多相关文章
- PAT 甲级 1104. Sum of Number Segments (20) 【数学】
题目链接 https://www.patest.cn/contests/pat-a-practise/1104 思路 最容易想到的一个思路就是 遍历一下所有组合 加一遍 但 时间复杂度 太大 会超时 ...
- PAT甲级——1104 Sum of Number Segments (数学规律、自动转型)
本文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90486252 1104 Sum of Number Segmen ...
- PAT 甲级 1104 sum of Number Segments
1104. Sum of Number Segments (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CAO, Pen ...
- PAT甲级——A1104 Sum of Number Segments【20】
Consider a positive integer N written in standard notation with k+1 digits ai as ak⋯a1a0 ...
- PAT (Advanced Level) 1104. Sum of Number Segments (20)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- PAT甲题题解-1104. Sum of Number Segments (20)-(水题)
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...
- PAT甲级——A1104 Sum of Number Segments
Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For exam ...
- 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 ...
- PAT甲级:1136 A Delayed Palindrome (20分)
PAT甲级:1136 A Delayed Palindrome (20分) 题干 Look-and-say sequence is a sequence of integers as the foll ...
随机推荐
- php执行shell脚本
本次想要配置webhook钩子, 做钩子大多是走 ssh 协议, coding 里配置部署公钥 之前用 docker 写钩子, 也是 ssh 权限的问题 包工具: 1.composer r ...
- Loj515 「LibreOJ β Round #2」贪心只能过样例 - Bitset,Dp
bitset的基本应用了 类似可行性背包的dp考虑 复杂度O(nmL/64) #include <bits/stdc++.h> using namespace std; bitset &l ...
- WSO2 ESB XML定义语法(1)
1.(基于Apache Synapse的WSO2 ESB实现)参考文件位置: http://synapse.apache.org/userguide/config.html 基于Apache Syna ...
- java通过浏览器请求头(User-Agent)获取访问者设备信息以及系统版本
个人博客 地址:http://www.wenhaofan.com/article/20181125220342 在开发AutuBlog项目时需要做后台的登录记录,想起浏览器的User-Agent,于是 ...
- 一个vue的日历组件
说明: 1.基于element-ui开发的vue日历组件. 地址 更新: 1.增加value-format指定返回值的格式2.增加头部插槽自定义头部 <ele-calendar > < ...
- P3391 【模板】文艺平衡树
模板题 link Splay 区间翻转,存个代码 旋转时,要注意goal是引用 , 并记得修改 , 有标记的一定记得标记下放 , 还有清空 #include<iostream> #incl ...
- poj1321棋盘问题(dfs+摆放问题)
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别.要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C. ...
- 【Unity|C#】基础篇(9)——匿名函数 / Lambda表达式
[学习资料] <C#图解教程>(第13章):https://www.cnblogs.com/moonache/p/7687551.html 电子书下载:https://pan.baidu. ...
- sysbench下载与安装
目标:下载.安装sysbench软件,做数据库压测 准备: 在sysbench启动的linux机器上,首先安装好mysql,查看mysql已经启动 例如,在机器上已经安装完mysql,其路径为 /us ...
- C#源码转PlantUml
1.下载编译开源工程PlantUmlClassDiagramGenerator 2.使用PlantUmlClassDiagramGenerator生成PlantUml文件 3.配置Vscode的Pla ...