average解题报告

本文是关于一道编程题的解题报告,题目要求找到序列中等于其他元素算术平均数的索引。作者经历了多次提交错误,最终发现问题是输出格式问题。解题代码使用C语言实现,通过计算平均数并比较数组元素来找出符合条件的索引。
摘要由CSDN通过智能技术生成

题目:

Average Numbers

时间限制: 1秒 内存限制: 64M

Problem Description

You are given a sequence of positive integers a1, a2, ..., an. Find all such indices i, that the i-th element equals the arithmetic mean of all other elements (that is all elements except for this one).

Input

The first line of the input is an integer t, which is the numbers of the test cases.

For each test case, the first line contains the integer n ( 2 ≤ n ≤ 2·10^5). The second line contains elements of the sequence a1, a2, ..., an ( 1 ≤ ai ≤ 1000). All the elements are positive integers.

Output

For each test case print on the first line the number of the sought indices. Print on the second line the sought indices in the increasing order. All indices are integers from 1 to n. If the soug

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值