#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 | #63815828 | Utilizator | |
| Fișier | xorsum.cpp | Dimensiune | 1.26 KB |
| Data încărcării | 19 Martie 2026, 21:05 | Scor/rezultat | Eroare de compilare |
xorsum.cpp:7:9: error: '__int128_t' does not name a type typedef __int128_t int128; ^ xorsum.cpp: In function 'int main()': xorsum.cpp:17:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 1; i <= n; ++i) { ^ xorsum.cpp:18:9: error: 'int128' was not declared in this scope int128 val = (int128)a[i - 1] * x + y; ^ xorsum.cpp:18:16: error: expected ';' before 'val' int128 val = (int128)a[i - 1] * x + y; ^ xorsum.cpp:19:22: error: 'val' was not declared in this scope a[i] = (ull)(val % z); ^ xorsum.cpp:22:5: error: 'int128' was not declared in this scope int128 totalSum = 0; ^ xorsum.cpp:22:12: error: expected ';' before 'totalSum' int128 totalSum = 0; ^ xorsum.cpp:29:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 1; i <= n; ++i) { ^ xorsum.cpp:38:16: error: expected ';' before 'pairs' int128 pairs = (int128)c1 * c0; ^ xorsum.cpp:41:16: error: expected ';' before 'bitValue' int128 bitValue = (int128)1 << b; ^ xorsum.cpp:42:16: error: expected ';' before 'term' int128 term = (pairs % t) * (bitValue % t); ^ xorsum.cpp:44:9: error: 'totalSum' was not declared in this scope totalSum = (totalSum + term) % t; ^ xorsum.cpp:44:32: error: 'term' was not declared in this scope totalSum = (totalSum + term) % t; ^ xorsum.cpp:35:19: warning: unused variable 'c0' [-Wunused-variable] long long c0 = n - c1; ^ xorsum.cpp:48: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ă.