The Array Problem
All submissions for this problem are available.
Shahid is a computer science student and his teacher gave him a simple question to solve within time but he is little busy in his life, so he asked you to solve this problem.
Problem statement : You have been given an array of positive integers A1,A2,...,An with legnth N and you have to print an array of same legnth(N) where the values in the new array are the sum of every number in the array, except the number at that index.
- The first line of input contains a single integer T denoting the number of test cases.
- Each test cases contain two lines.First line contains N, the length of the array and second line contains N space separated positive integers.
Output:For each test case, output a single array of same length.
- 1 ≤ T ≤ 100
- 1 ≤ N ≤105
- 0 <= A[i] <= 109
Example:Input 2 4 1 2 3 4 3 4 5 6 Output 9 8 7 6 11 10 9 Explanation
Test case 1: For the first index, the result will be 2+3+4= 9, similarly for the second, third and fourth index the corresponding results will be 8, 7 and 6 respectively.
|Tags||array, dshahid380, dshahid380, encoding, horsbug98|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions