Jump to content
A9N

[Easy] Ajutati-l pe Dorel

Recommended Posts

Posted

Dorel vrea sa sparga serverele N*S*. El afla ca parola pentru serverul arc.n*s*.gov este "criptata" conform algoritmului descris mai jos.

Din fericire Dorel are sirul de caractere criptat, care este informatica. (L-a luat de la cineva de pe IRC)

Ajuta-l pe Dorel sa afle parola!

Input: ? Output: informatica;


#include <iostream>
using namespace std;
int main()
{
char *p = new char[11];
cin >> p; // 11 caractere.
for(int i = 0; i < 11; i++)
switch(i) {
case 0: p[i] = (p[3] += 9, p[3] - 7); break;
case 2: p[i] = (p[9]-=1, p[9] + 2); break;
case 5: p[i] = (p[1]-=3,(p[1] | 12)-1); break;
case 6: p[i] = (p[4] += 1, p[4]/7*6+1); break;
case 7: p[i] = (p[10]+= 1,(p[10] | p[4]/6)+2);
case 8: p[i] +=(i%2 != 0? - i % 2: -9); break;
default: p[i]--; break;
}
cout << p;
delete []p;

return 0;
}

Inspirat din challange-ul lui em (cel referitor la tipurile de date).

Testeaza cunostintele legate de operatori in c++.

Raspunsuri pe PM.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...