hdu_5734_Acperience
题目连接:hdu_5734_Acperience
多校的题我还是贴官方题解的好,方便快捷,省事!!

#include<cstdio>
#include<cmath>
#define F(i,a,b) for(int i=a;i<=b;i++)
typedef long long ll; ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} int main()
{
int t,n,tp;
scanf("%d",&t);
while(t--)
{
ll fsum=,sum=;
scanf("%d",&n);
F(i,,n)scanf("%d",&tp),sum+=tp>?tp:-tp,fsum+=tp*tp;
sum*=sum,fsum*=n,fsum-=sum;
ll gc=gcd(fsum,n);
fsum/=gc,n/=gc;
printf("%lld/%d\n",fsum,n);
}
}
hdu_5734_Acperience的更多相关文章
随机推荐
- 如何设置linux的文件和目录的权限
1 字符表示法 1)chmod [-R] 权限(mode)file 注:[-R]会将目录下所有权限都设置成指定的 who operator permission u(owner) +增加权限 r( ...
- 阿里云 CentOS7.2 配置FTP+Node.js环境
本人小白,写下这篇博客意在记录踩过的坑,大神请绕道~ 准备工作 安装自己喜欢的连接软件(一般是putty或者xshell),本人选择的是xshell,软件如图 : 通过软件中的ssh连接连接上已经购买 ...
- 验证码计时 -- UIButton setTitle 闪烁问题解决方案
首先,有各种版本 方法一: 我运用的一种极其简单的版本: 将UIButton的Type 设成 Custom 就不会有闪烁的问题重现 p.p1 { margin: 0.0px 0.0px 0.0px ...
- maven添加本地依赖包方法
1.某些情况下不方便上传本地依赖包到Maven repository,可以通过下面方法添加本地依赖包. 2.方法 1).pom.xml中添加以下代码块 <dependency> <g ...
- 第二节windows系统下Xshell 5软件远程访问虚拟机 Linux系统
下载Xshell 5软件在windows下安装 安装好后Xshell 5启动软件 下一步,检查虚拟机,配置是否正确 下一步,设置网络,保障虚拟机系统能够连接网络 下一步,进入虚拟机系统,检查虚拟机网络 ...
- Java 集合 JDK1.7的LinkedList
Java 集合 JDK1.7的LinkedList @author ixenos LinkedList LinkedList是List接口的双向链表实现,JDK1.7以前是双向循环链表,以后是双向非循 ...
- 安装asterisk
在centos6.5上: yum -y install lynx mysql-server mysql mysql-devel php php-mysql php-mbstring tftp-serv ...
- .Net Core 上传图片
/// <summary> /// 图片上传并存入数据库 /// </summary> /// <returns></returns> public J ...
- LeetCode OJ 55. Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- gcc-config: Active gcc profile is invalid解决办法
错误描述 Gentoo软件安装错误,提示: gcc-config: Active gcc profile is invalid 解决方法: 列出可用的profile gcc-config -l gcc ...