码迷,mamicode.com
首页 > 其他好文 > 详细

九度oj1002

时间:2016-04-03 15:58:42      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:

判分标准啥的

?

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

标签:

原文地址:http://www.cnblogs.com/chendashennihao/p/5349934.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!