|
I'd go for a rather simple implementation; sort the values, highest value first. In a loop, fetch a number from the array. Move right and keep adding numbers until you hit maximum. At maximum, fetch new number.
That's a rather blunt way of doing it though - backtracking would give a better result.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
This looks a lot like the Subset-Sum problem, but not exactly...
Check out my "Alternative Tip": Subset - Sum Problem with Numeric Collections [^]
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G.K. Chesterton
|
|
|
|
|
Hi all,
I'm a long time reader and lurker of codeproject articles in the Daily Build. I really enjoy that some articles are quite simple and as I've progressed through my career, I've been able to learn from more in-depth thoughtful articles. I'm wondering if anyone has a similar place for mathematics. It would be nice if the articles would come to my email, but I'd like for it to have a wide array of expertise. Also, I'm not looking for a question/answer site, but rather somewhere people can share their ideas and findings that are not quite at the level of novel academic research (i.e. I'd like to understand what I'm reading). Does anyone know of a place?
Matthew Schmidt
Computational Physicist
Rhode Island Hospital
|
|
|
|
|
|
Hi!
So..i have some objects in set with integers properties.
player1 = {endurance:5,ovr:7},
player2 = {endurance:9,ovr:3},
....
I have to divide this set into 2 very well balanced subsets about their properties if 0 is min endurance and ovr and 10 is max endurance and ovr are the limits.
At first I had only one property and that was easy.First take the biggest and put it in the set A.The next biggest put it in the set B and etc..
So..Is there an algorithm that can solve my problem for 2 properties in this case? Thank you,guys!
|
|
|
|
|
What about using the same method you used before but basing it on the sum, or product (or other kind of operation) of endurance and ovr?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
|
<pre lang="C#">
Adam works in the in networking security cell. He wants to generate secret keys
following a pattern. The pattern consists of the characters X and Y.
where X means increasing and Y means decreasing. Help him devise an
algorithm to generate the secret key which is the minimum number encoded
following that pattern. Digits from 1-9 and digits can’t repeat.
Sample Input: Sample Output:
X 12
YXYX 21435
YYXYYXXY 321654798
</pre>
|
|
|
|
|
Your homework should serve the purpose that you learn something. And that something isn't supposed to be how to get other people to doing your homework for you.
Your assignments will get more difficult over time - so if you don't start doing them yourself now you'll never be able to.
So sit down, think about it and try something. If you then encounter a specific problem, feel free to ask - that's the idea of these forums.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Please, how decode a file ASN.1 (binary file) to a file readable in (c++, java)?
Thank you for response.
|
|
|
|
|
It depends what you mean by decode, and what the file contains. Please edit your question and add some proper detail.
|
|
|
|
|
Check out: NCBI ToolBox[^]
It includes a tool to convert ASN.1 to XML.
You could either modify the tool to produce what you want, or
use XSLT[^] to convert the XML to whatever format you want!
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G.K. Chesterton
|
|
|
|
|
Here is a thread about parsing the file in Java, Parsing ASN.1 binary data with Java - Stack Overflow[^]
But, it would also be possible in C++. Just read the standard specifications for the file type.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
when using master theorem
i know that a = the number of subproblems
b = size of the subproblem
d = time takes to combine the solutions
when b, the size of the subproblem is given as n-1, a = 2, d=1
how do you work out T(n)??
What I have tried:
T(n) = aT(n/b) + O(n)
T(n) = 4T(n-1) + O(n)
|
|
|
|
|
Hi
How can I decrypt the following message? Only information I have is that it might be encrypted with a program named Sec..or Crypt...something. Password might be PIN. It should have a www-page in it.
Any help would really be appreciated!
b3 43 67 9a 52 8a bb ef f8 d6 f5 c4 b0 5e f8 17 64 a9 55 cb 5b 17 cc e8 ba e7 32 0f a8 04 cf e0
f8 32 57 02 ca b7 88 66 69 c2 d7 0c bd 0e 46 84 98 c8 21 bd 92 b1 5d 27 a3 49 6c 80 58 0d f0 ce
cf 84 10 dd f5 f0 49 9a 80 70 23 51 f2 0e c2 f4 f5 77 e1 51 64 39 8e ee 8f a8 d1 b7 db fe aa d8
01 e0 aa 81 1d 69 ae
|
|
|
|
|
Sorry, but you won't get any help here for decrypting messages. Maybe your intention isn't non-ethical, maybe it is, we don't know.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
What school?
Even if brute force would be applied, you'd be testing each password for each available algorithm.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You need to discuss this with your teacher. You cannot easily decrypt anything without the algorithm or the key. I suspect there is some other piece of information that you need.
|
|
|
|
|
If this indeed a school assignment, it is presumably encrypted using one of the algorithms that you learnt about in the class, using a key that you should be able to guess.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
You have to know more than that. If you don't, it could be encrypted with a OTP, and then it could be literally anything (in the sense that whatever you want it to be, there's a key that makes it so).
|
|
|
|
|
More or less, the assignment goes like this (it is not in english, so i have to translate it).
You have an important e-mail and your job is to decrypt it before anyone else does.
---------------------------------------------------------------------------------------------
Hi,
I would need your help ASAP!
My hard drive broke and I lost my long used encryption program. Even tough I have tried to find this program everywhere I can not find it. Name of the program included sec...or...crypt... something. The encrypted message underneath has an important web address in it. I need it, please help me!
I am almost sure, that the encryption key was a PIN code. But I can not remember what it was.
Message:
b3 43 67 9a 52 8a bb ef f8 d6 f5 c4 b0 5e f8 17 64 a9 55 cb 5b 17 cc e8 ba e7 32 0f a8 04 cf e0
f8 32 57 02 ca b7 88 66 69 c2 d7 0c bd 0e 46 84 98 c8 21 bd 92 b1 5d 27 a3 49 6c 80 58 0d f0 ce
cf 84 10 dd f5 f0 49 9a 80 70 23 51 f2 0e c2 f4 f5 77 e1 51 64 39 8e ee 8f a8 d1 b7 db fe aa d8
01 e0 aa 81 1d 69 ae
|
|
|
|
|
At least that limits the key space. Well, have fun brute forcing it.
Could be cryptainer, cryptarchives, cryptoloop, secubox, SecureDoc.. or something else, who knows. It's not plain crypt though.
|
|
|
|
|
Member 12027696 wrote: the encryption key was a PIN code ..still 10.000 different combinations
You still did not tell us which school
--edit
There's some additional hints here[^]. Enjoy
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
modified 17-Mar-16 16:58pm.
|
|
|
|
|
I assume Daniel Pfeffer hit the spot with his reply to you. So try whichever encryption algorithm(s) you've learned about. And if the key was a PIN code there aren't too many possible values..
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Oh goody, if you read the description you can reduce it to a known plaintext attack.
That's as much of a hint as I'm giving
|
|
|
|