QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#329402#4932. Moon and Sunouo#WA 1ms3788kbC++141.3kb2024-02-16 17:09:462024-02-16 17:09:47

Judging History

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

  • [2024-02-16 17:09:47]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3788kb
  • [2024-02-16 17:09:46]
  • 提交

answer

#include <iostream>
#include <vector>

using namespace std;

const int MOD = 235813;

vector<int> generateNthRowPascalTriangle(int n)
{
    vector<int> nthRow;
    nthRow.push_back(1);

    for (int i = 1; i <= n - 1; ++i)
    {
        vector<int> temp = nthRow;
        for (int j = 1; j < i; ++j)
        {
            nthRow[j] = temp[j - 1] + temp[j];
        }
        nthRow.push_back(1);
    }

    return nthRow;
}

int main()
{
    int n;
    int hot = 0;
    cin >> n;
    vector<int> nthRow = generateNthRowPascalTriangle(n);
    vector<int> data(n);
    vector<long long> m(n);
    long long sum_ = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> data[i];
        m[i] = data[i] * nthRow[i];
        if (i != 0)
            m[i] *= -1;
        sum_ += m[i];
    }
    for (int i = 0; i < n; i++)
    {
        if ((((sum_ - m[i]) % MOD) % nthRow[i] == 0 && (-1e6 <= ((sum_ - m[i]) % MOD) / nthRow[i] <= 1e6) ||
             ((((sum_ - m[i]) % MOD) + MOD) % nthRow[i] == 0 && -1e6 <= (((sum_ - m[i]) % MOD) + MOD) / nthRow[i] <= 1e6) ||
             ((((sum_ - m[i]) % MOD) - MOD) % nthRow[i] == 0 && -1e6 <= (((sum_ - m[i]) % MOD) - MOD) / nthRow[i] <= 1e6)))
        {
            hot += 1;
        }
    }
    cout << hot << endl;

    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3468kb

input:

5
4 1 0 7 2

output:

3

result:

ok single line: '3'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

4
10 20 30 -40

output:

4

result:

ok single line: '4'

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3520kb

input:

2
100 100

output:

2

result:

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