竞赛讨论区 > 为什么只能通过10%的数据?
头像
leper
发布于 2019-02-07 14:03
+ 关注

为什么只能通过10%的数据?

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;                              //用ll代替long long
ll sum = 0;
ll n,m;
int main(){
    cin>>n>>m;
    ll number[n+1],color[n+1];
    for(ll i = 1;i <= n;i++)cin>>number[i];
    for(ll i = 1;i <= n;i++)cin>>color[i];
    for(ll x = 1;x <= n-2;x++)
        for(ll y = x+1;y <= n-1;y++)                   //枚举 x 和 y
            if(color[x] == color[y+(y-x)]){          //用 (y+(y-x)) 代表 z
                sum = sum + (x + (y + (y - x))) * (number[x] + number[y+(y-x)]);
            }
    cout<<sum % 10007;                            //无法通过实例2
    return 0;
}

全部评论

(1) 回帖
加载中...
话题 回帖

本文相关内容

等你来战

查看全部

热门推荐