P4811 C’s problem(c)
背景
清北NOIP春季系列课程
描述
题目描述
小C是一名数学家,由于它自制力比较差,经常通宵研究数学问题。
这次它因为这个数学问题已经两天两夜没有睡觉了,再不研究出来就要出人命了!快帮帮它吧!
这个问题是这样的,有n个数ai,对于任意两个数(i,j),小C能够得到ai*aj的欢乐值。小C知道这样子的数总共有n^2对,它想知道它能得到的欢乐值之和是多少。
输入格式
一行一个数表示n。 表示有n个数。
接下来一行n个数表示ai。
输出格式
一个数表示答案。
备注
输入样例
3
1 2 3
输出样例
36
数据范围
对于30%的数据n<=100。
对于50%的数据n<=1000。
对于100%的数据1<=n<=100000,0<=ai<=100。
P4811 C’s problem(c)
记录信息
记录号 S1435101
评测状态 Hidden
题目 P4811 C’s problem(c)
提交时间 -- ::
代码语言 C++
消耗时间 ms
消耗内存 KiB
代码
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
int a[];
int main()
{
int m;
long long int tot=;
scanf("%d",&m);
for(int i=;i<=m;i++)
{
scanf("%lld",&a[i]);
}
for(int i=;i<=m;i++)
{
for(int j=;j<=m;j++)
tot+=a[i]*a[j];
}
printf("%lld",tot);
return ;
}
P4811 C’s problem(c)的更多相关文章
- 1199 Problem B: 大小关系
求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...
- No-args constructor for class X does not exist. Register an InstanceCreator with Gson for this type to fix this problem.
Gson解析JSON字符串时出现了下面的错误: No-args constructor for class X does not exist. Register an InstanceCreator ...
- C - NP-Hard Problem(二分图判定-染色法)
C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:262144 ...
- Time Consume Problem
I joined the NodeJS online Course three weeks ago, but now I'm late about 2 weeks. I pay the codesch ...
- Programming Contest Problem Types
Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...
- hdu1032 Train Problem II (卡特兰数)
题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能. (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...
- BZOJ2301: [HAOI2011]Problem b[莫比乌斯反演 容斥原理]【学习笔记】
2301: [HAOI2011]Problem b Time Limit: 50 Sec Memory Limit: 256 MBSubmit: 4032 Solved: 1817[Submit] ...
- [LeetCode] Water and Jug Problem 水罐问题
You are given two jugs with capacities x and y litres. There is an infinite amount of water supply a ...
- [LeetCode] The Skyline Problem 天际线问题
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe ...
随机推荐
- 函数和常用模块【day05】:生成器并行计算(五)
本节内容 1.概述 2.生成器执行原理 3.send()和__next__()方法的区别 4.yield实现并行效果 一.概述 之前只是介绍生成器,那有些同学就说了,这个生成器除了能节省资源,提高工作 ...
- Python基础【day01】:PyChram使用技巧总结(六)
本节内容 1.添加或者修改文件模板 2. python版本管理切换 3.已有文件重命名4.Python模块安装5.在PyChram中直接浏览文件目录6. 断点调试7.常用快捷键8.PyChram设置字 ...
- 修改el-table滚动条样式
<include file="Trade:header" /> <style type="text/css" media="scre ...
- KindEditor的简单使用,以及上传图片预览图片,用户删除图片后的数据处理(重点),以及 BeautifulSoup,shutil两模块了解
KindEditor的简单了解 http://www.cnblogs.com/wupeiqi/articles/6307554.html 简单使用: <div class="comm& ...
- bzoj千题计划204:bzoj2813: 奇妙的Fibonacci
http://www.lydsy.com/JudgeOnline/problem.php?id=2813 若j能整除i,则f[j]能整除f[i] 题目就变成了求约数个数和.约数的平方和 http:// ...
- SQL Server 基础之《学生表-教师表-课程表-选课表》(二)
表结构 --学生表tblStudent(编号StuId.姓名StuName.年龄StuAge.性别StuSex) --课程表tblCourse(课程编号CourseId.课程名称CourseName. ...
- 第9月第6天 push pop动画 生成器模式(BUILDER)
1. https://github.com/MichaelHuyp/QQNews 2.生成器模式(BUILDER) class MazeBuilder { public: virtual void B ...
- linux远程windows执行命令
Linux下远程连接windows,执行命令 - Feng______的专栏 - 博客频道 - CSDN.NEThttp://blog.csdn.net/feng______/article/deta ...
- springcloud Eureka自我保护机制
自我保护背景 首先对Eureka注册中心需要了解的是Eureka各个节点都是平等的,没有ZK中角色的概念, 即使N-1个节点挂掉也不会影响其他节点的正常运行. 默认情况下,如果Eureka Serve ...
- 深入迁出mybatis系列
本系列教程均源于南柯梦,经好库文摘转发,感谢南柯梦的辛苦整理. 深入迁出mybatis系列 深入浅出Mybatis系列(一)---Mybatis入门 深入浅出Mybatis系列(二)---配置简介(m ...