第二次授课&&90分钟

1059

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n;
    cin >> n;
    int c = 0;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        c += x;
    }
    printf("%.2f", c * 1.0 / n);
    return 0;
}

1060

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n;
    cin >> n;
    double c = 0;
    for (int i = 0; i < n; i++)
    {
        double x;
        cin >> x;
        c += x;
    }
    printf("%.4f", c / n);
    return 0;
}

1061

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n;
    cin >> n;
    int c = 0;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        c += x;
    }
    printf("%d %.5f", c, c * 1.0 / n);
    return 0;
}

1062

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n;
    cin >> n;
    int c = 0;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        c = max(c, x);
    }
    cout << c << endl;
    return 0;
}

1063

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n;
    cin >> n;
    int c = 0, a = 10000;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        c = max(c, x);
        a = min(a, x);
    }
    cout << c - a << endl;
    return 0;
}

1064

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n;
    cin >> n;
    int c = 0, a = 0, b = 0;
    for (int i = 0; i < n; i++)
    {
        int x, y, z;
        cin >> x >> y >> z;
        a += x;
        b += y;
        c += z;
    }
    cout << a << " " << b << " " << c << " " << a + b + c << endl;
    return 0;
}

1072

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n;
    cin >> n;
    int c, a;
    cin >> c >> a;
    double b = a * 1.0 / c;
    for (int i = 1; i < n; i++)
    {
        int x, y;
        cin >> y >> x;
        if (b - x * 1.0 / y > 0.05)
            cout << "worse\n";
        else if (x * 1.0 / y - b > 0.05)
            cout << "better\n";
        else
            cout << "same\n";
    }

    return 0;
}

1073

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n;
    cin >> n;
    double c = 0;
    for (int i = 0; i < n; i++)
    {
        double x, y;
        int r;
        cin >> x >> y >> r;
        double s = sqrt(x * x + y * y);

        c += r + s * 1.0 / 50 * 2 + 0.5 * r;
    }
    cout << ceil(c) << endl;
    return 0;
}

1074

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n = 12;
    // cin >> n;
    int c = 0;
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        c += 300;
        if ((c - x) / 100)
        {
            sum += (c - x) / 100 * 100;
            c = c - (c - x) / 100 * 100;
        }
        c = c - x;
        if (c < 0)
        {
            cout << "-" << i + 1 << endl;
            return 0;
        }
    }
    cout << (int)(sum * 1.2 + c) << endl;
    return 0;
}

1077

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n = 12;
    cin >> n;
    int cc = 0;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        int a = x % 10;
        int b = x / 10 % 10;
        int c = x / 100 % 10;
        int d = x / 1000 % 10;
        if (a - b - c - d > 0)
            cc++;
    }
    cout << cc << endl;
    return 0;
}

1102

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n = 12;
    cin >> n;
    int c = 0;
    int a[100];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int x;
    cin >> x;
    for (int i = 0; i < n; i++)
        if (x == a[i])
            c++;
    cout << c << endl;
    return 0;
}

1103

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n = 10;
    // cin >> n;
    int c = 0;
    int a[100];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int x;
    cin >> x;
    for (int i = 0; i < n; i++)
        if (x + 30 >= a[i])
            c++;
    cout << c << endl;
    return 0;
}

1104

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n = 10;
    double c = 0;
    double a[10] = {28.9, 32.7, 45.6, 78, 35, 86.2, 27.8, 43, 56, 65};
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        c += a[i] * x;
    }
    printf("%.1f", c);
    return 0;
}

1105

#include <bits/stdc++.h>
using namespace std;

signed main()
{
    int n = 10;
    cin >> n;
    int a[100];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int x;
    cin >> x;
    for (int i = n - 1; i >= 0; i--)
        cout << a[i] << " ";
    return 0;
}

1114

#include <bits/stdc++.h>
using namespace std;

int st[1000];
// st[] :0 可选
// 1 最大
// 2 最小

signed main()
{
    int n;
    cin >> n;

    double a[305];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    int ma = 0, mi = 0; // 最大值和最小值的位置
    for (int i = 0; i < n; i++)
    {
        if (a[i] > a[ma])
        {
            ma = i;
        }
        if (a[i] < a[mi])
        {
            mi = i;
        }
    }
    double sum = 0;
    for (int i = 0; i < n; i++)
    {
        if (i == ma || i == mi)
            continue;
        else
            sum = sum + a[i];
    }

    double pj = sum / (n - 2);
    double c = 0;
    for (int i = 0; i < n; i++)
    {
        if (i == ma || i == mi)
            continue;
        else
            c = max(c, abs(a[i] - pj));
    }
    printf("%.2f %.2f", pj, c);

    return 0;
}

1115

#include <bits/stdc++.h>
using namespace std;
int n;
int num[10010];

int s[10010];
int main()
{
    cin >> n;
    int fmax = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> num[i];
        if (num[i] > fmax)
        {
            fmax = num[i];
        }
    }

    for (int j = 0; j < n; j++)
    {
        s[num[j]]++;
    }
    for (int i = 0; i <= fmax; i++)
    {
        cout << s[i] << endl;
    }
}
posted @ 2023-03-16 14:04  zzh1206  阅读(65)  评论(0)    收藏  举报