#3556
Se dau numerele naturale n, x, y, z, t. Se generează vectorul a astfel: a[i] = (a[i-1] * x + y) % z, pentru 1 ≤ i ≤ n si a[i] = 0 pentru i = 0. Determinați ∑(a[i] XOR a[j]), unde 1 ≤ i < j ≤ n, modulo t.
| Problema | xorsum | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 1 MB
/
Stivă 1 MB
|
| Id soluție | #63815988 | Utilizator | |
| Fișier | xorsum.cpp | Dimensiune | 1.79 KB |
| Data încărcării | 19 Martie 2026, 21:13 | Scor/rezultat | Eroare de compilare |
xorsum.cpp:9:18: error: expected unqualified-id before '__int128' typedef unsigned __int128 u128; ^ xorsum.cpp: In function 'int main()': xorsum.cpp:26:24: error: 'u128' was not declared in this scope a[i] = (ull)(((u128)a[i - 1] * x + y) % z); ^ xorsum.cpp:26:29: error: expected ')' before 'a' a[i] = (ull)(((u128)a[i - 1] * x + y) % z); ^ xorsum.cpp:26:51: error: expected ')' before ';' token a[i] = (ull)(((u128)a[i - 1] * x + y) % z); ^ xorsum.cpp:42:5: error: 'u128' was not declared in this scope u128 totalSum = 0; ^ xorsum.cpp:42:10: error: expected ';' before 'totalSum' u128 totalSum = 0; ^ xorsum.cpp:43:10: error: expected ';' before 'modT' u128 modT = (u128)t; ^ xorsum.cpp:52:14: error: expected ';' before 'pairs' u128 pairs = (u128)count_1 * count_0; ^ xorsum.cpp:53:14: error: expected ';' before 'bitValue' u128 bitValue = (u128)1 << b; ^ xorsum.cpp:56:14: error: expected ';' before 'term' u128 term = (pairs % modT) * (bitValue % modT); ^ xorsum.cpp:57:9: error: 'totalSum' was not declared in this scope totalSum = (totalSum + term) % modT; ^ xorsum.cpp:57:32: error: 'term' was not declared in this scope totalSum = (totalSum + term) % modT; ^ xorsum.cpp:57:40: error: 'modT' was not declared in this scope totalSum = (totalSum + term) % modT; ^ xorsum.cpp:49:19: warning: unused variable 'count_0' [-Wunused-variable] long long count_0 = (long long)n - count_1; ^ xorsum.cpp:61:28: error: 'totalSum' was not declared in this scope ull finalResult = (ull)totalSum; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema xorsum 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ă.