I need to translate C++ code of my friends to say Perl/Haskell code to avoid getting detected by cheating checker of codeforces. Google translate doesn't work :( Can anyone suggest any alternative ? Thanks in advance
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
I need to translate C++ code of my friends to say Perl/Haskell code to avoid getting detected by cheating checker of codeforces. Google translate doesn't work :( Can anyone suggest any alternative ? Thanks in advance
How to solve this : link
I am pretty new unfortunately. So this is the question i just can't figure out how to solve.
Statement:
Sveta loves chocolates. More specifically she loves to have Gems chocolates. In PET most people love numbers, so here the different types of Gems are distinguished by numbers(unlike the boring blue/green/red colors).
As you already know, PET is a magical place. So every Wednesday, the Gems in the packet mysteriously increase in quantity. While most people never bothered to find out the reason, Sveta, being a smart girl, decoded the pattern in which this weird phenomenon occurred. She noticed that if the Gem had a number N, it would split into Gems with numbers in range of 2 to N-1 if the numbers were a factor of N. This splitting would go on until there was no way to split any remaining Gems in this manner.
Now Puru wants to know the final sum of numbers of the Gems after magical transformation in order to impress Sveta. Help him out.
Input:
First line contains T number of testcases
Next line contains N, the number of Gems in the packet Sveta has bought
Next line contains N integers, denoting the number assigned to each gem.
Output:
Print the sum of numbers of all gems after the magical transformation has taken place.
Constraints:
1 <= T <= 1000
1 <= N <= 40
2 <= number assigned to gems <= 10^4
Sample:
Input:
1
2
2 12
Output:
14
Explanation:
Now the first gem with value 2 can't divide as per the rules, so it stays as it is. Gem with number 12 divides into 4 gems with numbers 2,3,4 and 6. Now gems 2 and 3 cant divide, however gems 4 and 6 can divide into gems 2 and gems 2,3 respectively. Now the gems can't divide anymore and the magical transformation ends. So the result is 2 + 2+3 + 2 + 2+3 = 14
By first finding depth of each node using BFS, then selecting nodes with maximum depth, we can implement Dijsktra to find the path. Once you get the path, just look at the path for 15 seconds else you'll get WA. Then look at cats in path. Also look at hawks , snipers, terrorists as well, since they can easily kill a parrot.
Then do headshot snipers and use cats to kill the hawks.
After doing all this, use BrainF**k to submit your code
Have a nice Day
Is it really hard ?
Name |
---|