#631
Alexandru dorește să devină expert în securitate, iar pentru aceasta s-a apucat să învete mai multe despre siguranța parolelor. El dorește să afle câte parole poate crea folosind a litere mici ale alfabetului englez și b litere mari ale alfabetului englez, c cifre si d caractere din mulțimea {!, @, #, $, %}. Totodată, el vrea să găsească parola cu numărul x în ordine lexicografică, formată din caracterele descrise mai sus.
Cunoscând a, b, c, d si x se cere:
a) A x-a parolă în ordine lexicografică, formată din caracterele menționate în enunț.
b) Numărul de parole diferite formate din caracterele menționate în enunț, modulo 666013.
| Problema | Passwd | Operații I/O |
passwd.in/passwd.out
|
|---|---|---|---|
| Limita timp | 0.3 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
| Id soluție | #58790871 | Utilizator | |
| Fișier | passwd.cpp | Dimensiune | 6.86 KB |
| Data încărcării | 08 August 2025, 21:42 | Scor/rezultat | Eroare de compilare |
passwd.cpp: In function 'long long int power(long long int, long long int)': passwd.cpp:16:46: error: expected type-specifier before '__int128' if (exp % 2 == 1) res = (static_cast<__int128>(res) * base) % M; ^ passwd.cpp:16:46: error: expected '>' before '__int128' passwd.cpp:16:46: error: expected '(' before '__int128' passwd.cpp:16:46: error: expected primary-expression before '__int128' passwd.cpp:16:46: error: expected ')' before '__int128' passwd.cpp:16:46: error: expected ')' before '__int128' passwd.cpp:17:29: error: expected type-specifier before '__int128' base = (static_cast<__int128>(base) * base) % M; ^ passwd.cpp:17:29: error: expected '>' before '__int128' passwd.cpp:17:29: error: expected '(' before '__int128' passwd.cpp:17:29: error: expected primary-expression before '__int128' passwd.cpp:17:29: error: expected ')' before '__int128' passwd.cpp:17:29: error: expected ')' before '__int128' passwd.cpp: In function 'void solve_b(int, int, int, int)': passwd.cpp:51:27: error: expected type-specifier before '__int128' result = (static_cast<__int128>(result) * term_a) % M; ^ passwd.cpp:51:27: error: expected '>' before '__int128' passwd.cpp:51:27: error: expected '(' before '__int128' passwd.cpp:51:27: error: expected primary-expression before '__int128' passwd.cpp:51:27: error: expected ')' before '__int128' passwd.cpp:51:27: error: expected ')' before '__int128' passwd.cpp:52:27: error: expected type-specifier before '__int128' result = (static_cast<__int128>(result) * term_b) % M; ^ passwd.cpp:52:27: error: expected '>' before '__int128' passwd.cpp:52:27: error: expected '(' before '__int128' passwd.cpp:52:27: error: expected primary-expression before '__int128' passwd.cpp:52:27: error: expected ')' before '__int128' passwd.cpp:52:27: error: expected ')' before '__int128' passwd.cpp:53:27: error: expected type-specifier before '__int128' result = (static_cast<__int128>(result) * term_c) % M; ^ passwd.cpp:53:27: error: expected '>' before '__int128' passwd.cpp:53:27: error: expected '(' before '__int128' passwd.cpp:53:27: error: expected primary-expression before '__int128' passwd.cpp:53:27: error: expected ')' before '__int128' passwd.cpp:53:27: error: expected ')' before '__int128' passwd.cpp:54:27: error: expected type-specifier before '__int128' result = (static_cast<__int128>(result) * term_d) % M; ^ passwd.cpp:54:27: error: expected '>' before '__int128' passwd.cpp:54:27: error: expected '(' before '__int128' passwd.cpp:54:27: error: expected primary-expression before '__int128' passwd.cpp:54:27: error: expected ')' before '__int128' passwd.cpp:54:27: error: expected ')' before '__int128' passwd.cpp:45:15: warning: unused variable 'term_a' [-Wunused-variable] long long term_a = power(26, a); ^ passwd.cpp:46:15: warning: unused variable 'term_b' [-Wunused-variable] long long term_b = power(26, b); ^ passwd.cpp:47:15: warning: unused variable 'term_c' [-Wunused-variable] long long term_c = power(10, c); ^ passwd.cpp:48:15: warning: unused variable 'term_d' [-Wunused-variable] long long term_d = power(5, d); ^ passwd.cpp: In function 'long long unsigned int combinations_ull(int, int)': passwd.cpp:68:14: error: expected unqualified-id before '__int128' unsigned __int128 res = 1; ^ passwd.cpp:70:9: error: 'res' was not declared in this scope res = res * (n - i + 1) / i; ^ passwd.cpp:73:9: error: 'res' was not declared in this scope if (res >= ULL_INF) return ULL_INF; ^ passwd.cpp:74:32: error: 'res' was not declared in this scope return (unsigned long long)res; ^ passwd.cpp: In function 'long long unsigned int count_perms_ull(int, int, int, int)': passwd.cpp:90:68: error: '__builtin_mul_overflow' was not declared in this scope if (__builtin_mul_overflow(multinomial, temp_comb, &multinomial)) return ULL_INF; ^ passwd.cpp:94:68: error: '__builtin_mul_overflow' was not declared in this scope if (__builtin_mul_overflow(multinomial, temp_comb, &multinomial)) return ULL_INF; ^ passwd.cpp:99:49: error: '__builtin_mul_overflow' was not declared in this scope if (__builtin_mul_overflow(res, 26, &res)) return ULL_INF; ^ passwd.cpp:102:49: error: '__builtin_mul_overflow' was not declared in this scope if (__builtin_mul_overflow(res, 26, &res)) return ULL_INF; ^ passwd.cpp:105:49: error: '__builtin_mul_overflow' was not declared in this scope if (__builtin_mul_overflow(res, 10, &res)) return ULL_INF; ^ passwd.cpp:108:48: error: '__builtin_mul_overflow' was not declared in this scope if (__builtin_mul_overflow(res, 5, &res)) return ULL_INF; ^ passwd.cpp: In function 'long long unsigned int combinations_ull(int, int)': passwd.cpp:75:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Passwd face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.