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 ...
随机推荐
- LSTM介绍
转自:https://blog.csdn.net/gzj_1101/article/details/79376798 LSTM网络 long short term memory,即我们所称呼的LSTM ...
- 百度钱包、百付宝、baifubao接入支付的常见问题
[5004:参数非法,请检查输入参数后重试.]:检查是否缺少了其它必要的参数,我当时是缺少了order_no [5804,抱歉,订单创建失败,请联系客服处理]:即验证签名失败,这个只能参考文档进行处理 ...
- POJ-1459 Power Network(最大流)
https://vjudge.net/problem/POJ-1459 题解转载自:優YoU http://user.qzone.qq.com/289065406/blog/1299339754 解题 ...
- Codeforces 835E. The penguin's game
http://codeforces.com/problemset/problem/835/E 题意: 这是一道交互题 有n个数,其中有2个y,n-2个x 每次你可以询问若干个数的异或和,从而得出y的位 ...
- Spring 学习02
一.上节内容回顾 1 spring的概念 (1)核心:ioc和aop (2)spring一站式框架 2 spring的bean管理(xml) (1)bean实例化 (2)注入属性 (3)注入对象属性 ...
- dedecms织梦首页判断,添加不同标题
<title> {dede:field.title/} {dede:field name='typeid' runphp="yes"}(@me==0)? @me=&qu ...
- [整理]Git使用文章整理
http://pcottle.github.io/learnGitBranching/ http://www.ruanyifeng.com/blog/2012/07/git.html
- 20155339 2016-2017-2 《Java程序设计》第6周学习总结
20155339 2016-2017-2 <Java程序设计>第6周学习总结 教材学习内容总结 第十章 串流设计 Java将输入/输出抽象化为串流,数据有来源及目的地,衔接两者的是串流对象 ...
- CSS Pseudo-classes
先来一条金科玉律: 伪类的效果可以通过添加一个实际的类来达到:伪元素的效果可以通过添加一个实际的元素来达到. 第一部分,Pseudo-classes,伪类 一.链接系 (这个应该是最熟悉的啦.) a: ...
- 【Pyhon】利用BurpSuite到SQLMap批量测试SQL注入
前言 通过Python脚本把Burp的HTTP请求提取出来交给SQLMap批量测试,提升找大门户网站SQL注入点的效率. 导出Burp的请求包 配置到Burp的代理后浏览门户站点,Burp会将URL纪 ...