啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊

题意:

略。

思路:

略。。。。真分数。。。

= =、我今天是纠结去死了。哎,继续加油,就比如gfd说的还有下一场,下下场,不要烦,不要绝望,因为,这算什么?

)扔份代码跑。

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
using namespace std;
#define PI acos(-1.0)
#define INF 0x3f3f3f
#define MAX 100010
#define ll long long
ll a[MAX]; int main()
{
int i,j,t;
ll n;
scanf("%d",&t);
while(t--)
{
ll sum=0;
scanf("%lld",&n);
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
a[i]=abs(a[i]);
sum+=a[i];
a[i]*=n;
}
ll ss,xx,nn;
nn=n*n;
ss=xx=0;
for(i=0;i<n;i++)
{
xx+=(a[i]-sum)*(a[i]-sum);
if(xx>nn){
ss+=xx/nn;
xx%=nn;
}
}
ll r=__gcd(xx,nn);
nn/=r;
xx/=r;
printf("%lld/%lld\n",xx+ss*nn,nn);
}
return 0;
}

2016 Multi-University Training Contest 2 A Acperience的更多相关文章

  1. 2016 Al-Baath University Training Camp Contest-1

    2016 Al-Baath University Training Camp Contest-1 A题:http://codeforces.com/gym/101028/problem/A 题意:比赛 ...

  2. 2016 Al-Baath University Training Camp Contest-1 E

    Description ACM-SCPC-2017 is approaching every university is trying to do its best in order to be th ...

  3. 2016 Al-Baath University Training Camp Contest-1 A

    Description Tourist likes competitive programming and he has his own Codeforces account. He particip ...

  4. 2016 Al-Baath University Training Camp Contest-1 J

    Description X is fighting beasts in the forest, in order to have a better chance to survive he's gon ...

  5. 2016 Al-Baath University Training Camp Contest-1 I

    Description It is raining again! Youssef really forgot that there is a chance of rain in March, so h ...

  6. 2016 Al-Baath University Training Camp Contest-1 H

     Description You've possibly heard about 'The Endless River'. However, if not, we are introducing it ...

  7. 2016 Al-Baath University Training Camp Contest-1 G

    Description The forces of evil are about to disappear since our hero is now on top on the tower of e ...

  8. 2016 Al-Baath University Training Camp Contest-1 F

    Description Zaid has two words, a of length between 4 and 1000 and b of length 4 exactly. The word a ...

  9. 2016 Al-Baath University Training Camp Contest-1 D

    Description X is well known artist, no one knows the secrete behind the beautiful paintings of X exc ...

随机推荐

  1. UVA 1482 - Playing With Stones(SG打表规律)

    UVA 1482 - Playing With Stones 题目链接 题意:给定n堆石头,每次选一堆取至少一个.不超过一半的石子,最后不能取的输,问是否先手必胜 思路:数值非常大.无法直接递推sg函 ...

  2. weex 小结

    1. import  文件时,必须引入全称,不能省略 .vue import mEcharts from '../components/Echarts.vue' 2.weex 的 cli 中没有 配置 ...

  3. winform窗体继承泛型类时,设计器无法使用解决办法

    当我们使用winform程序时,winform窗体程序和控件程序都是可以通过设计器进行控件拖拽的,但如果我们继承了一个带有泛型的form基类.那么设计器是无法使用的. 目前我没有找到根本解决的办法,但 ...

  4. HBase技术简介

    一.HBase简介 HBase – Hadoop Database,是一个高可靠性.高性能.面向列.可伸缩的分布式存储系统,利用HBase技术可在廉价PC Server上搭建起大规模结构化存储集群. ...

  5. 设计模式入门之原型模式Prototype

    //原型模式:用原型实例指定创建对象的种类,并通过拷贝这些原型创建新的对象 //简单来说,当进行面向接口编程时,假设须要复制这一接口对象时.因为不知道他的详细类型并且不能实例化一个接口 //这时就须要 ...

  6. fill函数和fill_n函数

    fill_n函数的作用是:给你一个起始点,然后再给你一个数值count和val.把从起始点开始依次赋予count个元素val的值. 注意: 不能在没有元素的空容器上调用fill_n函数 列子:     ...

  7. unknownhostexception错误解决方案

    关于java.net.UnknownHostException大家也许都比较熟悉,今天我来整理一下关于java.net.UnknownHostException的各种处理办法: 1.在Android项 ...

  8. window.open() 父子页面的传值问题

    if(window.opener){//判断是否有父窗口,即打开本页面的窗口       window.opener.location.reload();//刷新父窗口       window.op ...

  9. JAVA 保留两位小数

    package com.oracle.pojo; import java.math.BigDecimal; import java.text.DecimalFormat; import java.te ...

  10. PostgreSQL源码解读 基础结构 node

    一.node节点的定义 源代码路径postgresql-9.2.3/src/include/nodes/nodes.h 在查询解析SQL的查询部分,要用到大量的结构体,许多函数处理的逻辑类似,就是传入 ...