九度oj1002

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了九度oj1002相关的知识,希望对你有一定的参考价值。

判分标准啥的

?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include"iostream"
#include"stdlib.h"
#include"stdio.h"
#include<iomanip>
#include<cmath>
using namespace std;
int max(int a, int b, int c)
{
    if (a >=b)
    {
        if (a >= c)
            return a;
        else
        {
            return c;
        }
    }
    else
    {
        if (b >= c)
            return b;
        else
        {
            return c;
        }
    }
}
int  main( )
{
    int full_mark, tolerence, G1, G2, G3, Gj;
    double resu;
    while (cin >> full_mark >> tolerence >> G1 >> G2 >> G3 >> Gj)
    {
        if (abs(G1 - G2) <= tolerence)
            resu =(double) (G1 + G2) / 2.0;
        else if (abs(G3 - G1) > tolerence && abs(G3 - G2) <= tolerence)
        {
            resu = (double)(G3 + G2) / 2.0;
        }
        else if (abs(G3 - G2) > tolerence && abs(G3 - G1) <= tolerence)
        {
            resu = (double)(G3 + G1) / 2.0;
        }
        else if (abs(G3 - G1) <= tolerence && abs(G3 - G2) <= tolerence)
            resu = max(G1, G2, G3)+1.0-1.0;
        else
        {
            resu = (double)Gj + 1.0 - 1.0;
        }
        printf("%.1lf\n", resu);
    }
    return 0;
}

以上是关于九度oj1002的主要内容,如果未能解决你的问题,请参考以下文章

九度oj 题目1397:查找数段

九度OJ-题目1009:二叉搜索树

九度OJ平台练习 —— 题目1009

oj---九度oj---1061

oj---九度oj---1433

oj---九度oj---1434