QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#809160#9255. Python ProgramHiraethsoul#WA 0ms3544kbC++234.6kb2024-12-11 12:41:182024-12-11 12:41:18

Judging History

你现在查看的是最新测评结果

  • [2024-12-11 12:41:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3544kb
  • [2024-12-11 12:41:18]
  • 提交

answer

#include <bits/stdc++.h>

#define int long long

signed main()
{
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);

    std::string a, b, c, d, e;
    getline(std::cin, a);
    getline(std::cin, b);
    getline(std::cin, c);
    getline(std::cin, d);
    getline(std::cin, e);

    int A, B, C, D, E, F;

    int pos = 15;
    int now = 0;
    while (isdigit(b[pos]))
    {
        now = now * 10 + b[pos] - '0';
        ++pos;
    }
    A = now;
    now = 0;
    ++pos;
    while (isdigit(b[pos]))
    {
        now = now * 10 + b[pos] - '0';
        ++pos;
    }
    B = now;
    now = 0;
    ++pos;
    if (b[pos] == '-')
    {
        ++pos;
        while (isdigit(b[pos]))
        {
            now = now * 10 + b[pos] - '0';
            ++pos;
        }
        C = -now;
    }
    else if (isdigit(b[pos]))
    {
        while (isdigit(b[pos]))
        {
            now = now * 10 + b[pos] - '0';
            ++pos;
        }
        C = now;
    }
    else
    {
        C = 1;
    }
    pos = 15;
    now = 0;
    while (isdigit(c[pos]))
    {
        now = now * 10 + c[pos] - '0';
        ++pos;
    }
    D = now;
    if (pos == 15)
    {
        D = 1e18;
        ++pos;
    }
    now = 0;
    ++pos;
    int cur = pos;
    while (isdigit(c[pos]))
    {
        now = now * 10 + c[pos] - '0';
        ++pos;
    }
    E = now;
    if (pos == cur)
    {
        E = 1e18;
        ++pos;
    }
    now = 0;
    ++pos;
    if (c[pos] == '-')
    {
        ++pos;
        while (isdigit(c[pos]))
        {
            now = now * 10 + c[pos] - '0';
            ++pos;
        }
        F = -now;
    }
    else if (isdigit(c[pos]))
    {
        while (isdigit(c[pos]))
        {
            now = now * 10 + c[pos] - '0';
            ++pos;
        }
        F = now;
    }
    else if (islower(c[pos]))
    {
        F = 1e18;
    }
    else
    {
        F = 1;
    }

    if (C < 0)
    {
        A -= C;
        B -= C;
        std::swap(A, B);
        C = -C;
    }
    if (D > 2e9 and E > 2e9) // DE
    {
        std::cout << 0 << '\n';
        return 0;
    }
    if (D > 2e9 and F > 2e9)
    {
        int ans = 0;
        for (int i = A; i < B; i += C)
        {
            int inf = (E - 1) / i;
            if (i < E)
            {
                ans += (1 + inf) * inf / 2 * i;
            }
        }
        std::cout << ans << '\n';
        return 0;
    }
    if (F > 2e9 and E > 2e9)
    {
        int ans = 0;
        for (int i = A; i < B; i += C)
        {
            if (D < i)
            {
                ans += D;
            }
        }
        std::cout << ans << '\n';
        return 0;
    }
    if (F > 2e9)
    {
        int ans = 0;
        for (int i = A; i < B; i += C)
        {
            int inf = std::max((E - D - 1) / i, 0ll);
            if (D < E)
            {
                ans += (D + D + (inf)*i) * (inf + 1) / 2;
            }
        }
        std::cout << ans << '\n';
        return 0;
    }
    else
    {
        if (F < 0)
        {
            D -= F;
            E -= F;
            std::swap(D, E);
            F = -F;
        }
        if (D > 2e9)
        {
            int ans = 0;
            for (int i = A; i < B; i += C)
            {
                int inf = std::max((E - i - 1) / F, 0ll);
                if (i < E)
                {
                    ans += (i + i + inf * F) * (inf + 1) / 2;
                }
                // i->E 每次+F
            }
            std::cout << ans << '\n';
            return 0;
        }
        else if (E > 2e9)
        {
            int ans = 0;
            for (int i = A; i < B; i += C)
            {
                int inf = std::max((i - D - 1) / F, 0ll);
                if (D < i)
                {
                    ans += (D + D + inf * F) * (inf + 1) / 2;
                }
                // D->i 每次+F
            }
            std::cout << ans << '\n';
            return 0;
        }
        else
        {
            int ans = 0;
            for (int i = A; i < B; i += C)
            {
                int inf = std::max((E - D - 1) / F, 0ll);
                if (D < E)
                {
                    ans += (D + D + inf * F) * (inf + 1) / 2;
                }
                // D->i 每次+F
            }
            std::cout << ans << '\n';
            return 0;
        }
    }

    // 一定是正数

    // 第三位是步长

    // 可能有好几个1e18
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3544kb

input:

ans=0
for a in range(1,3):
    for b in range(5,1,-2):
        ans+=b
print(ans)

output:

0

result:

wrong answer 1st lines differ - expected: '16', found: '0'