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

题意:

略。

思路:

略。。。。真分数。。。

= =、我今天是纠结去死了。哎,继续加油,就比如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. LeetCode ||& Word Break && Word Break II(转)——动态规划

    一. Given a string s and a dictionary of words dict, determine if s can be segmented into a space-sep ...

  2. css设置图片居中、居左、居右

      CreateTime--2017年12月8日14:25:09 Author:Marydon css设置图片居中.居左.居右 图片一般默认是居左显示的,如何更改它的水平位置呢? <div st ...

  3. 【转载】轻松搞懂WebService工作原理

    用更简单的方式给大家谈谈WebService,让你更快更容易理解,希望对初学者有所帮助. WebService是基于网络的.分布式的模块化组件. 我们直接来看WebService的一个简易工作流程: ...

  4. js中创建html标签、加入select下默认的option的value和text、删除select元素节点下全部的OPTION节点

    <pre name="code" class="java"> jsp 中的下拉框标签: <s:select name="sjx&qu ...

  5. 安装Sublime配合quick-cocos2d-x开发

    下载地址 Sublime下载地址 安装 Package Control 在Sublime中,按Ctrl+~打开控制台,输入: Sublime Text2 import urllib2,os; pf=' ...

  6. poj3253 Fence Repair【哈夫曼树+优先队列】

    Description Farmer John wants to repair a small length of the fence around the pasture. He measures ...

  7. Git使用之Permission Denied问题解决

    今天碰到了Git的Permission Denied问题. 在安装好git之后,我们通常会配置username和邮箱 git config --global user.name "zengj ...

  8. 状态模式-State

    状态模式:当一个对象的内在状态改变时允许改变其行为,这个对象看起来像是改变了其类. 状态模式结构图: 代码实现:

  9. log Configuration

    Log4j – Configuring Log4j 2 - Apache Log4j 2 https://logging.apache.org/log4j/2.x/manual/configurati ...

  10. OpenMAX IL介绍与其体系

    1  OpenMAX IL介绍与其体系 这一部分的文档描写叙述 OpenMAX IL的特性与体系. 1.1  OpenMAX IL 简述 OpenMAX IL 软件接口层定义了一套API.用于訪问系统 ...