SDUT 3919 Special Judge Ⅰ
来源:互联网 发布:算法 pdf 高清 编辑:程序博客网 时间:2024/06/05 10:30
SDUT 3919 Special Judge Ⅰ
Time Limit: 1000MS Memory Limit: 65536KB
Problem Description
SDUT OJ 上默认的评测机制是严格 ICPC 模式,它要求提交的程序运行输入数据后的输出结果和标准答案完全一致。
而 Special Judge 是一种特殊的评判模式,它允许程序的输出结果和测试数据(标准答案)在一定范围内即使不同,也可以被判定为 Accepted。
通常,Special Judge 会通过运行一个特判程序来检测用户的输出是否符合要求。
现在以最简单的浮点数误差的特判程序为例,假设允许的最大浮点误差为 eps = 1e-2(即 10^(-2) = 0.01),如果用户的输出为 0.125,测试数据为 0.128,则误差为 0.003 < 1e-2,判定为 Accepted。代码实现如下:
if(fabs(user_out - std_out) <= eps)
{
printf(“Accepted\n”);
}
else
{
printf(“Wrong Answer\n”);
}
现在 Stone 提交了若干次代码,你需要写一个特判程序来判断他的答案是否正确。
不过出题人并没有告诉你他想设置的 eps 是多少,只告诉你范围是 1e0, 1e-1, 1e-2, 1e-3, 1e-4, …, 1e-14 这十五个中的一个,你需要猜一个 eps 并写出符合要求的特判程序。
Input
输入数据有多组(数据组数不超过 100),到 EOF 结束。
对于每组数据,输入 2 个浮点数 a, b,其中 a 表示 Stone 的程序运行结果,b 表示后台测试数据。
保证 a, b 均在 double 范围内。
Output
对于每组数据,如果 Stone 的程序正确,输出一行 “Accepted”,否则输出一行 “Wrong Answer”(输出不包括引号)。
Example Input
1.00 1.0
62.55 66.233
Example Output
Accepted
Wrong Answer
Hint
示例 C 语言代码中,fabs() 是绝对值函数,需要头文件 math.h。
精度误差 eps 建议定义为 double 型,例如,猜 eps 为 1e-6,则写成:double eps = 1e-6;
请使用 double 型读入数据。
Author
「“师创杯”山东理工大学第九届ACM程序设计竞赛 热身赛」MLE_kenan
Submit
#include <bits/stdc++.h>using namespace std;int main(){ double a, b, eps = 1e-9; while(~scanf("%lf%lf", &a, &b)) { if(fabs(a-b) <= eps) printf("Accepted\n"); else printf("Wrong Answer\n"); } return 0;}
非洲人千万不要用随机数,就手动从1改到1e-14就好了,39发前车之鉴
- SDUT 3919 Special Judge Ⅰ
- SDUT 3920 Special Judge Ⅱ
- SDUT 3921 Special Judge Ⅲ
- Special Judge Ⅰ
- Special Special Judge III ZOJ
- coj 1344: Special Judge
- Special Judge Ⅱ
- zoj3411-Special Special Judge-高精度dp
- 1721. Gray code[Special judge]
- 1721. Gray code[Special judge]
- [sicily]1151. 魔板[Special judge]
- [sicily]1151. 魔板[Special judge]
- 简单魔板[Special judge]
- 【POI2001】和平委员会(Special Judge)
- 从零开始写OJ---Special Judge
- poj1015 背包/动态规划(Special Judge,Special Love)
- ZOJ3413 Special Special Judge III(数形结合)
- 【图论】【RQNOJ】心许的回忆[Special Judge]
- java-DAO模式实现数据库增,删,改,查和传统模式实现数据库增,删,改,查对比-JDBC
- 海量数据存储管理
- getline()详解
- canvas插入图片和画文字
- [kuangbin带你飞]专题十二 基础dp1
- SDUT 3919 Special Judge Ⅰ
- C#——Marshal.StructureToPtr方法简介
- 二叉树的链式结构
- linux安装rabbitMq
- java类加载器
- cocos2dx lua编译打包安卓报的错误汇总
- git使用笔记
- Error from server: error dialing backend: dial tcp: lookup xxx on 114.114.114.114:53: no such
- 【动态规划08】bzoj3831Little Bird(dp+单调队列)