90分求助,第二点RE怎么办?为什么RE?
查看原帖
90分求助,第二点RE怎么办?为什么RE?
574884
Kasumi_Hakurei楼主2021/10/16 10:07

代码如下

#include <iostream>

using namespace std;

int asd[111] = {0};//计算有没有重复
int ans = 0;
int main()
{
    int n;
    cin >> n;

    long long store[n];//读入的所有数
    for (int i = 0;i < n;++i)
        cin >> store[i];

    for (int i = 0;i < n;++i)
    {
        for (int j = i + 1;j < n;++j)
        {
            for (int h = 0;h < n;++h)
                if (store[i] + store[j] == store[h] && h != i && h != j)
                    if (asd[store[h]] != 1)
                    {
                        asd[store[h]] = 1;
                        ++ans;
                    }
        }
    }
    cout << ans;

    return 0;
}
2021/10/16 10:07
加载中...