#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e2+10; int main()
{
int T,cas=1,n,x;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
int up=0;
int down=n;
for(int i=1;i<=n;i++)
{
scanf("%d",&x);
up+=abs(x);
if(x<0)
down--;
}
if(!down)
printf("Case %d: inf\n",cas++);
else
{
int g=__gcd(up,down);
printf("Case %d: %d/%d\n",cas++,up/g,down/g);
}
}
return 0;
}

lightoj 1027【数学概率】的更多相关文章

  1. lightoj 1027 简单概率dp

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1027 #include<cstdio> #include<cstri ...

  2. LightOJ - 1027 数学期望

    题意:有n扇门,每扇门有一个值x,大于0代表x分钟后出去,小于0代表x分钟后回到原地,求出去的时间的期望 题解:假设出去的总时间为sum1,回来的总时间为sum2,出去的门个数为out,进来的门的个数 ...

  3. LightOj 1027 A Dangerous Maze【概率】

    题目链接:http://www.lightoj.com/volume_showproblem.php? problem=1027 题意: 你面前有n个门,每一个相应一个数字,若为正xi.代表xi分钟后 ...

  4. 概率 lightoj 1027

    题意 : 在n个门前选择一扇门出去, 然后如果第i扇门的 Xi值是正的话,你会花费Xi时间后出去 , 如果Xi是负数的话你会花费-Xi时间后回到老地方,并且忘记了刚才的选择, 选择一扇门的概率是等概的 ...

  5. LightOJ 1027 A Dangerous Maze (数学期望)

    题意:你面前有 n 个门,每次你可以选择任意一个进去,如果xi是正数,你将在xi后出去,如果xi是负数,那么xi后你将回来并且丢失所有记忆,问你出去的期望. 析:两种情况,第一种是直接出去,期望就是 ...

  6. LightOJ 1027 - A Dangerous Maze(求期望)

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1027 题意:又一个迷宫,有n个门,每个门又一个值num,如果num>0 说明在n ...

  7. [LightOJ 1027] A Dangerous Maze

    A Dangerous Maze You are in a maze; seeing n doors in front of you in beginning. You can choose any ...

  8. Lightoj 1027 - A Dangerous Maze 【期望】

    1027 - A Dangerous Maze PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Y ...

  9. Codeforces Round #370 (Div. 2) E. Memory and Casinos (数学&&概率&&线段树)

    题目链接: http://codeforces.com/contest/712/problem/E 题目大意: 一条直线上有n格,在第i格有pi的可能性向右走一格,1-pi的可能性向左走一格,有2中操 ...

随机推荐

  1. 三星note3 N900刷机包 4.4.2 ZSUDNE3 官方原汁原味 稳定流畅

    ROM介绍 此ROM基于最新的4.4.2 ZSUDNE3 制作,加入一些必要功能,其它性能基本与官方无差距,各方面感觉都非常不错了.此ROM本人自用,所以制作风格有点个人倾向.不论什么建议或者问题欢迎 ...

  2. js比较3个数字的大小

    <script> var a = [1, 5, 2, 123, 34, 43, 7]; var i = j = t = 0; //sort方法, 推荐使用 a.sort(function( ...

  3. yuicompressor

      yui/yuicompressor: YUI Compressor https://github.com/yui/yuicompressor    YUI Compressor 详细介绍 YUI ...

  4. The Little Match Girl,摘自iOS应用Snow White and more stories

    Many years ago on a cold and snowy New Year's Eve, a poor little girl was wandering arround on the s ...

  5. Linux就该这么学--命令集合2(系统状态检测命令)

    1.查看本机当前的网卡配置与网络状态等信息:(ifconfig [网络设备] [参数]) ifconfig 2.查看系统的内核名称.内核发行版.内核版本.节点名.硬件名称.硬件平台.处理器类型.操作系 ...

  6. Protocol_BGP

    BGP协议 作者:Danbo 2015-7-8 BPG最重要的就是属性,下面我们针对路径属性分析一下.

  7. 基于S3C2440的linux-3.6.6移植——LED驱动【转】

    本文转载自:http://www.voidcn.com/blog/lqxandroid2012/article/p-625005.html 目前的linux版本的许多驱动都是基于设备模型,LED也不例 ...

  8. oracle查看锁表进程,杀掉锁表进程

    查看锁表进程SQL语句1: select sess.sid,     sess.serial#,     lo.oracle_username,     lo.os_user_name,     ao ...

  9. ffmpeg full help

    Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile ...

  10. Android-Universal-Image-Loader使用介绍

    简介 Android上最让人头疼的莫过于从网络获取图片.显示.回收,任何一个环节有问题都可能直接OOM,这个项目或许能帮到你.Universal Image Loader for Android的目的 ...