Above is the perl code I want to reduce.Can someone help?I am new to perl and somehow I wrote the code in perl and using differnt golfing techniques I reduced the code from 72 to 56 characters but there is someone with 51 characters code .
Modulo Strength Max. Marks: 100 Alice is the teacher of a class having N students, where each student is having some personality value, given in the form of an array A. Here Ai denotes the personality value of ith student, where 1≤i≤N. Alice has special integer K with her. Student i is a friend of Student j, if and only if (A[i]%K)=(A[j]%K). Each student's strength is equal to the number of friends he/she has. Alice needs to calculate the sum of the strength of all the students in the class. Help Alice for the same.
Note: This is a Code golf problem. You need to write code with minimum number of characters.
Input: First line contains 2 integers N,K, denoting the number of students in the class and the special integer Alice is having respectively. Second line contains N space separated integers, denoting the personality value of each student.
Output: Print the sum of the strength of all the students in the class.
Constraints: 1≤N≤10^5 1≤K≤10^5 1≤Ai≤10^9
If your program passes all the testcases, the score will be assigned according to the following formula:
score = 0.1 num_chars = length of source code if (num_chars < 500): Score = (500 - 2*num_chars) / 5
Update
@j=split$",<>;print$% map$%+=2*$q[$_%@j[1]]++,split$",<>Above is the perl code I want to reduce.Can someone help?I am new to perl and somehow I wrote the code in perl.
In reply to Golf code in perl by tt08
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |