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 ...
随机推荐
- Scala进阶之路-Scala函数篇详解
Scala进阶之路-Scala函数篇详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.传值调用和传名调用 /* @author :yinzhengjie Blog:http: ...
- Linux问题集锦
一些会遇到的问题,我会不断更新问题集锦~ 1.vi / vim保存文件时遇到的问题:E212: Can't open file for writing 在vi / vim下输入w或wq!保存编辑的文 ...
- JavaScript中函数和类(以及this的使用<重点>,以及js和jquery讲解,原生js实现jquery)
1.javascript中以函数来表示类: 一般函数是小写开头:function foo() 类开头是大写:function Foo() 实例化类: obj = new Foo() 其他属性就同类是一 ...
- centos6.x下安装maven
转自:http://www.centoscn.com/image-text/install/2014/0507/2923.html 1.下载maven包首先从官网上 http://maven.apac ...
- MySQL和Sql Server的sql语句区别
1.自增长列的插入:SQLServer中可以不为自动增长列插入值,MySQL中需要为自动增长列插入值. 2.获取当前时间函数:SQLServer写法:getdate()MySQL写法:now() 3. ...
- 第10月第20天 afnetwork like MKNetworkEngine http post
1. + (AFHTTPRequestOperation *)requestSellerWithCompletion:(requestFinishedCompletionBlock)successBl ...
- opencv附加依赖性选择,提示找不到opencv_world400d.dll
连接器>>输入>>附加依赖项,添加opencv_world400d.lib库文件名,在....\opencv\build\x64\vc14\lib有2个lib文件, 带d的是d ...
- Struts2不扫描jar包中的action
今天在做一个二开的项目,将struts打成jar包放在WEB-INF的目录下却扫描不到指定的路径,也就是http访问访问不到我们指定的action,其他代码可以正常使用,就是访问不到action.st ...
- 使用phpstorm+wamp实现php代码实时调试审计
转载自:https://www.bugbank.cn/q/article/5853afaffc0bf4f010ee6ac3.html php调试有N多好用的工具,最近研究到phpstorm配合wamp ...
- va_start(),va_end()函数应用【转】
转自:http://www.cnblogs.com/gogly/articles/2416833.html 原理解释: VA_LIST 是在C语言中解决变参问题的一组宏,在<stdarg.h&g ...