#include<iostream>
#include<cmath>
#include<iomanip>
#define MAXN 50
using namespace std; int _m[MAXN];
int gcd(int a,int b);
int main()
{
//freopen("acm.acm","r",stdin);
int n;
int i;
int j;
double sum_all;
double sum;
while(cin>>n,n)
{
sum = ;
sum_all = ;
for(i = ; i < n; ++ i)
{
cin>>_m[i];
}
for(i = ; i < n; ++ i)
{
for(j = i+; j < n; ++ j)
{
if(gcd(_m[i],_m[j]) == )
{
++ sum;
}
++ sum_all;
}
}
if(sum == )
{
cout<<"No estimate for this data set."<<endl;
continue;
} cout<<setiosflags(ios::fixed)<<setprecision()<<sqrt(((sum_all*6.0)/sum))<<endl;
} } int gcd(int a,int b)
{
if(b == )
return a;
return gcd(b,a%b);
}

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。

技术网站地址: vmfor.com

POJ 1491的更多相关文章

  1. poj 题目分类(1)

    poj 题目分类 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K--0.50K:中短代码:0.51K--1.00K:中等代码量:1.01K--2.00K:长代码:2.01 ...

  2. POJ题目分类(按初级\中级\高级等分类,有助于大家根据个人情况学习)

    本文来自:http://www.cppblog.com/snowshine09/archive/2011/08/02/152272.spx 多版本的POJ分类 流传最广的一种分类: 初期: 一.基本算 ...

  3. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

  4. 转载:poj题目分类(侵删)

    转载:from: POJ:http://blog.csdn.net/qq_28236309/article/details/47818407 按照ac的代码长度分类(主要参考最短代码和自己写的代码)  ...

  5. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  6. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  7. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  8. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  9. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

随机推荐

  1. 刀哥多线程之03GCD 常用代码

    GCD 常用代码 体验代码 异步执行任务 - (void)gcdDemo1 { // 1. 全局队列 dispatch_queue_t q = dispatch_get_global_queue(0, ...

  2. C/C++ 对常见字符串库函数的实现

    在c中的string.h头文件中存在很多对字符串进行操作的函数,利用这些函数可以方便的对字符串进行操作.下面将对常见的字符串函数进行解释和实现. strcpy 函数原型:char* _strcpy(c ...

  3. 每日一练--C语言--串

    目标 实现串的经典模式匹配算法与KMP算法. 简述 自定义串结构: 串采用定长顺序存储结构,串从下标1开始存储,0下标存储串的实际长度: 匹配成功返回匹配位置,匹配失败返回0. #include &l ...

  4. android bluetooth UUID蓝牙查询表

    ServiceDiscoveryServerServiceClassID_UUID = '{00001000-0000-1000-8000-00805F9B34FB}' BrowseGroupDesc ...

  5. http://www.linuxso.com/linuxpeixun/10332.html

    http://blog.chinaunix.net/uid-134240-id-62371.html http://blog.chinaunix.net/uid-26495963-id-3279216 ...

  6. pcre 使用

    1.主页地址:http://www.pcre.org/     下载pcre-7.8.tar.bz22.解压缩:     tar xjpf pcre-7.8.tar.bz23.配置:     cd p ...

  7. base64和图片的互转(HTML5的File实现)

    <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="C ...

  8. IOS中GPS定位偏移纠正(适用于Google地图)

    在这个神奇的国度里,我们总得学习一些有中国特色的东东,例如“火星坐标”.也许有人还不知道这是什么玩意,我就简要介绍一下吧.      如果你有带GPS模块的智能手机,打开定位功能,然后访问Google ...

  9. UIView的创建与内存管理

    学习过程中遇到一些问题,现在记录下来,以后忘记以便翻看. 创建工程的步骤: xcode的ARC改为MRC .h文件中的strong改为retain .m文件中加入dealloc方法 .m文件中_win ...

  10. dev 激活没有权限问题

    用管理员身份打开 Microsoft Visual Studio 2010-->Visual Studio Tools-->Visual Studio 命令提示(2010) 然后输入一下命 ...