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 ...
随机推荐
- python---补充locals()变量在变量分发中的使用
在Django,tornado等框架中,变量分发渲染模板是一件再平常不过的事,但是当变量过多时,如何快速的进行变量传递 此时就可以用到locals()获取本地变量,将变量变为字典传入 def intr ...
- git 查看一个分支是否被合并过
1.查看该分支的提交历史 git log 分支名 2.git log master |grep comitid 如果包含,就证明已经合并过 3.git branch -d 分支名,如果报错,就是没合并 ...
- AngularJS 启程三
<!DOCTYPE html> <html lang="zh_CN"> <head> <title>字数小例子</title& ...
- JavaScript编写风格指南 (三)
七(七):严格模式 // 严格模式应当仅限在函数内部使用,千万不要在全局使用 //不好的写法:全局使用严格模式"user strict"; function doSomething ...
- 玩转Hook——Android权限管理功能探讨(二)
距离我上一篇研究ptrace的随笔http://www.cnblogs.com/zealotrouge/p/3544147.html已经过去半年了,最近不忙的时候抽空继续研究了下.同样,参考了Prad ...
- Ubuntu下ibus在firefox浏览器中选中即删除的解决办法
Ubuntu上的firefox更新到36版后,ibus在浏览器中输入中文时选中的文字就会被删除.这个问题在很多贴吧.论坛上也有讨论,不过很多方法都无效.最简单有效的办法就是在命令行输入 ibus-se ...
- springboot整合rabbirmq(3.7.9)中使用mandatory参数获取匹配失败的消息以及存入rabbitmq备份交换器中!
先说下这个参数的作用: /** * Mandatory为true时,消息通过交换器无法匹配到队列会返回给生产者 * 为false时,匹配不到会直接被丢弃 */在一些特定场景下还是有用处的!接下来说一下 ...
- ruby http爬虫中的 :body 用法问题
require 'http' url = 'http://localhost/b.php' data = 'whoami=whoami' html = HTTP.via('127.0.0.1',808 ...
- Linux常见问题总结【转】
作为一名合格的 Linux 运维工程师,一定要有一套清晰.明确的解决故障思路,当问题出现时,才能迅速定位.解决问题,这里给出一个处理问题的一般思路: 重视报错提示信息:每个错误的出现,都是给出错误提示 ...
- poj2056
寻找向左凸的地方,每个左凸能让S数量-2.上边或下边如果是半个左凸的话则各对应-1 #include <cstdio> #include <cstring> #include ...