- 求和
- 2016-08-22 21:32:04 @
评测结果
编译成功
测试数据 #0: Accepted, time = 15 ms, mem = 1292 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 1288 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 1288 KiB, score = 10
测试数据 #3: Accepted, time = 15 ms, mem = 1288 KiB, score = 10
测试数据 #4: TimeLimitExceeded, time = 1031 ms, mem = 1280 KiB, score = 0
测试数据 #5: TimeLimitExceeded, time = 1015 ms, mem = 1280 KiB, score = 0
测试数据 #6: TimeLimitExceeded, time = 1031 ms, mem = 1280 KiB, score = 0
测试数据 #7: TimeLimitExceeded, time = 1031 ms, mem = 1280 KiB, score = 0
测试数据 #8: TimeLimitExceeded, time = 1203 ms, mem = 1280 KiB, score = 0
测试数据 #9: TimeLimitExceeded, time = 1015 ms, mem = 1280 KiB, score = 0
TimeLimitExceeded, time = 6356 ms, mem = 1292 KiB, score = 40
代码
#include <cstdio>
int color[100001],number[100001];
int main() {
//freopen("sum.in","r",stdin);
//freopen("sum.out","w",stdout);
int n,m;
scanf("%d%d",&n,&m);
for (int i = 1;i <= n;i++) scanf("%d",&number[i]);
for (int i = 1;i <= n;i++) scanf("%d",&color[i]);
int sum = 0;
for (int i = 1;i < n;i++)
for (int j = i+1;j <= n;j++)
if (color[i] == color[j] &&
((!(i%2) && !(j%2)) || (j%2 && i%2))) {
sum += (i+j)*(number[i]+number[j]);
sum %= 10007;
}
printf("%d",sum);
return 0;
}
1 条评论
-
唐复之 LV 8 @ 2016-08-22 22:37:32
呵呵,呵呵,呵呵呵
- 1
信息
- ID
- 1976
- 难度
- 8
- 分类
- (无)
- 标签
- 递交数
- 3003
- 已通过
- 400
- 通过率
- 13%
- 被复制
- 16
- 上传者