题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1141

Sample Input

Sample Output
100.00
97.56
50.00
 #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <vector>
using namespace std; #define N 12000
#define INF 0x3f3f3f3f int f[N]; int q(long long m)
{
int k=(int)sqrt(m);
for(int i=;i<=k;i++)
if(m%i==)
return ;
return ;
} int main()
{
int a,b;
f[]=; for(int i=;i<N;i++)
f[i]=f[i-]+q(i*i+i+); while(scanf("%d%d", &a,&b) != EOF)
{
double s;
if(a==)
s=1.0*f[b]/(b-a+);
else
s=1.0*(f[b]-f[a-])/(b-a+);
printf("%.2f\n", s*+1e-);
} return ;
}

UVA 10200 Prime Time (打表)的更多相关文章

  1. UVA 10200 Prime Time 水

    题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...

  2. UVA 10200 Prime Time【暴力,精度】

    题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...

  3. UVA - 10200 Prime Time 关于 double类型 卡精度

    题意: 给定一个区间,a到b, n在区间内,有一个计算素数的公式,n*n+n+41,将n带进去可以得出一个数字.但是这个公式可能不准确,求出这个公式在这个区间内的准确率. 直接模拟就好了,不过要 注意 ...

  4. UVA - 11827 - Maximum GCD,10200 - Prime Time (数学)

    两个暴力题.. 题目传送:11827 Maximum GCD AC代码: #include <map> #include <set> #include <cmath> ...

  5. UVA - 524 Prime Ring Problem(dfs回溯法)

    UVA - 524 Prime Ring Problem Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & % ...

  6. Prime Time UVA - 10200(精度处理,素数判定)

    Problem Description Euler is a well-known matematician, and, among many other things, he discovered ...

  7. 【数论】Prime Time UVA - 10200 大素数 Miller Robin 模板

    题意:验证1~10000 的数 n^n+n+41 中素数的个数.每个询问给出a,b  求区间[a,b]中质数出现的比例,保留两位 题解:质数会爆到1e8 所以用miller robin , 另外一个优 ...

  8. UVA 10140 - Prime Distance(数论)

    10140 - Prime Distance 题目链接 题意:求[l,r]区间内近期和最远的素数对. 思路:素数打表,打到sqrt(Max)就可以,然后利用大的表去筛素数.因为[l, r]最多100W ...

  9. UVa 1644 Prime Gap (水题,暴力)

    题意:给定一个数 n,求它后一个素数和前一个素数差. 析:先打表,再二分查找. 代码如下: #pragma comment(linker, "/STACK:1024000000,102400 ...

随机推荐

  1. python学习入门第一天总结

    虽然之前自己也看过许多关于python的视频,但一直没有动力与勇气,所以未能坚持且也没有学得这么深刻,这次希望通过python自动化培训,能够彻底改变自己,通过第一天的python学习,自己学到了许多 ...

  2. docker私服

    1.下载私服镜像docker pull registry 2.启动容器docker run -d -p 5000:5000 -v /opt/data/registry:/var/lib/registr ...

  3. 8636 跳格子(dfs+记忆化搜索)

    8636 跳格子 该题有题解 时间限制:2457MS  内存限制:1000K提交次数:139 通过次数:46 题型: 编程题   语言: G++;GCC Description 地上有一个n*m 的数 ...

  4. mybatis---------insert,delete ,update的批量操作

    在数据量大的情况下,可以使用批量 提高性能 批量插入insert 方法一: <insert id="insertbatch" parameterType="java ...

  5. 关于LCD的分屏与切屏 Tearing effect

    详细文档(带图片):http://download.csdn.net/detail/xuehui869/5268852 1.LCM之Fmark功能 http://blog.csdn.net/zhand ...

  6. 《剑指Offer》算法题——替换空格

    题目:请实现一个函数,将一个字符串中的空格替换成“ % 20”.例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are % 20Happy. class Solution ...

  7. 修改IP的方法(C#)

    1. wmi 代码以后补 需要获取全部IP后,统一添加(貌似会造成网络瞬断) 2. iphlpapi.lib 代码以后补 可以直接添加和删除IP 3. netsh 可以直接添加和删除IP

  8. Codeforces Round #354 (Div. 2)_Vasya and String(尺取法)

    题目连接:http://codeforces.com/contest/676/problem/C 题意:一串字符串,最多改变k次,求最大的相同子串 题解:很明显直接尺取法 #include<cs ...

  9. Storm官方文档翻译之在生产环境集群中运行Topology

    在进群生产环境下运行Topology和在本地模式下运行非常相似.下面是步骤: 1.定义Topology(如果使用Java开发语言,则使用TopologyBuilder来创建) 2.使用StormSub ...

  10. LeetCode OJ 66. Plus One

    Given a non-negative number represented as an array of digits, plus one to the number. The digits ar ...