#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 | #63816086 | Utilizator | |
| Fișier | xorsum.cpp | Dimensiune | 823 B |
| Data încărcării | 19 Martie 2026, 21:19 | Scor/rezultat | Eroare de compilare |
xorsum.cpp: In function 'int main()': xorsum.cpp:11:5: error: expected primary-expression before '__int128' __int128 Z = z; ^ xorsum.cpp:11:5: error: expected ';' before '__int128' xorsum.cpp:13:9: error: expected primary-expression before '__int128' __int128 val = ((__int128)(i - 1) * x + y) % Z; ^ xorsum.cpp:13:9: error: expected ';' before '__int128' xorsum.cpp:14:20: error: 'val' was not declared in this scope ll v = (ll)val; ^ xorsum.cpp:22:5: error: expected primary-expression before '__int128' __int128 T = t; ^ xorsum.cpp:22:5: error: expected ';' before '__int128' xorsum.cpp:28:9: error: expected primary-expression before '__int128' __int128 pairs = ((__int128)(c0 % t) * (c1 % t)) % T; ^ xorsum.cpp:28:9: error: expected ';' before '__int128' xorsum.cpp:29:9: error: expected primary-expression before '__int128' __int128 contrib = (pairs * ((__int128)1 << b)) % T; ^ xorsum.cpp:29:9: error: expected ';' before '__int128' xorsum.cpp:31:26: error: 'contrib' was not declared in this scope ans = (ans + (ll)contrib) % t; ^ xorsum.cpp:26:12: warning: unused variable 'c0' [-Wunused-variable] ll c0 = n - c1; ^ xorsum.cpp:7:54: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%lld%lld%lld%lld%lld", &n, &x, &y, &z, &t); ^
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ă.