PAT甲题题解-1104. Sum of Number Segments (20)-(水题)
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
using namespace std;
/*
对于第i个数字(i=0~n-1),它每组出现的次数为n-i,出现在前i+1个组中
*/
const int maxn=+;
double num[maxn];
int main()
{
int n;
scanf("%d",&n);
double sum=0.0f;
for(int i=;i<n;i++){
scanf("%lf",&num[i]);
sum+=num[i]*(n-i)*(i+);
}
printf("%.2lf",sum);
return ;
}
PAT甲题题解-1104. Sum of Number Segments (20)-(水题)的更多相关文章
- 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) 【数学】
题目链接 https://www.patest.cn/contests/pat-a-practise/1104 思路 最容易想到的一个思路就是 遍历一下所有组合 加一遍 但 时间复杂度 太大 会超时 ...
- 【PAT甲级】1104 Sum of Number Segments (20 分)
题意:输入一个正整数N(<=1e5),接着输入N个小于等于1.0的正数,输出N个数中所有序列的和. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC ...
- PAT 甲级 1104 sum of Number Segments
1104. Sum of Number Segments (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CAO, Pen ...
- PAT甲级——1104 Sum of Number Segments (数学规律、自动转型)
本文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90486252 1104 Sum of Number Segmen ...
- PAT甲题题解-1012. The Best Rank (25)-排序水题
排序,水题因为最后如果一个学生最好的排名有一样的,输出的课程有个优先级A>C>M>E那么按这个优先级顺序进行排序每次排序前先求当前课程的排名然后再与目前最好的排名比较.更新 至于查询 ...
- PAT甲题题解-1058. A+B in Hogwarts (20)-大水题
无语,这种水题还出,浪费时间,但又不得不A... #include <iostream> #include <cstdio> #include <algorithm> ...
- PAT甲题题解-1062. Talent and Virtue (25)-排序水题
水题,分组排序即可. #include <iostream> #include <cstdio> #include <algorithm> #include < ...
- PAT 1104 Sum of Number Segments
Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For exam ...
随机推荐
- Maven搭建私服
为什么要搭建私服?搭建私服有什么好处? 以我最近技术调研和相关的使用为起点概述: 首先说明,为什么要搭建私服? 搭建私服的目的是,通常企业项目开发,特别是使用maven作为项目管理,现在非常流行使用m ...
- 记一次MyBatis的错误
错误信息:java.lang.StackOverflowError 关于这个错误的深度解析,大家可以参考这篇博文,比较详细:https://blog.csdn.net/zc375039901/arti ...
- <Android 开源库> PhotoPicker 从头到脚
1. 简介 PhotoPicker, 是一款开源的图片选择器.效果上和微信相似. 2. 使用方法 2.1 添加依赖 dependencies { compile 'me.iwf.photopicker ...
- 解决php编译报错configure: error: mcrypt.h not found. Please reinstall libmcrypt.
yum install -y epel-releaseyum install -y libmcrypt-devel
- JS简单的倒计时(代码优化)
倒计时网上一大堆,所以也没有什么好说的,支持:1.年,月,日,天,时分秒等倒计时. JS代码如下: /* * js简单的倒计时 * @param {date,obj} 日期 对象格式 */ funct ...
- linux_vim
今天稍微学习以下vim 学习的一些课件: 1. 2. 3. 4. 5.
- iscsi target IET架构
IET(iSCSI Enterprise Target)是内核态实现的iscsi target,相比于用户态实现的target(比如tgt),iet比较稳定,并且也算是历史悠久,io都直接经过内核态, ...
- 2017-2018-2 20155230《网络对抗技术》实验8:Web基础
实践过程记录 1.Web前端HTML 首先用指令sudo apt-get install apache2下载apache,由于实验机已经安装好Apache,这里就不演示了,对于Apache使用的端口我 ...
- 20155310《网络对抗》Exp2 后门原理与实践
20155310<网络对抗>Exp2 后门原理与实践 基础问题回答 1.例举你能想到的一个后门进入到你系统中的可能方式? 在网上下载软件的时候,后门很有可能被捆绑在下载的软件当中: 浏览网 ...
- 全虚拟化和半虚拟化的区别 cpu的ring0 ring1又是什么概念? - 转
http://www.cnblogs.com/xusongwei/archive/2012/07/30/2615592.html ring0是指CPU的运行级别,ring0是最高级别,ring1次之, ...