#2863
Fie k
, n
și y
trei numere naturale. Fie X
un șir format din n
numere naturale: \( x_1, x_2, x_3, …, x_n \). Fie P
produsul numerelor \( y, x_1, x_2, x_3, …, x_n \), adică \( P = y\times x_1\times x_2 \times x_3 \times … \times x_n \). Numărul P
este o “k-putere” dacă există un număr natural z
astfel încât \( P=z^k \).
Scrieți un program care să citească numerele \( k, n, x_1, x_2, x_3, …, x_n \) și care să determine:
X
ce sunt formate doar din cifre identice;y
(y ≥ 2
) cu proprietatea că numărul \( P = y\times x_1\times x_2 \times x_3 \times … \times x_n \) este o “k-putere”.Problema | pyk | Operații I/O |
![]() pyk.in /pyk.out
|
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 8 MB
/
Stivă 8 MB
|
Id soluție | #57579041 | Utilizator | |
Fișier | pyk.cpp | Dimensiune | 2.02 KB |
Data încărcării | 05 Aprilie 2025, 21:47 | Scor / rezultat | Eroare de compilare |
pyk.cpp:19:23: error: conflicting declaration 'long long int f' long long r,k,n,i,x,d,f,a[10009],cnt,mi=999999999,ma,u,c,ok; ^ pyk.cpp:5:10: error: 'f' has a previous declaration as 'std::ifstream f' ifstream f("pyk.in"); ^ pyk.cpp: In function 'int main()': pyk.cpp:79:22: error: no match for 'operator=' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'long long int') f=k-(a[i]%k); ^ pyk.cpp:79:22: note: candidate is: In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:69:0, from pyk.cpp:1: /usr/include/c++/4.8/fstream:427:11: note: std::basic_ifstream<char>& std::basic_ifstream<char>::operator=(const std::basic_ifstream<char>&) <deleted> class basic_ifstream : public basic_istream<_CharT, _Traits> ^ /usr/include/c++/4.8/fstream:427:11: note: no known conversion for argument 1 from 'long long int' to 'const std::basic_ifstream<char>&' pyk.cpp:95:26: error: no match for 'operator=' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'long long int') f=k-(a[i]%k); ^ pyk.cpp:95:26: note: candidate is: In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:69:0, from pyk.cpp:1: /usr/include/c++/4.8/fstream:427:11: note: std::basic_ifstream<char>& std::basic_ifstream<char>::operator=(const std::basic_ifstream<char>&) <deleted> class basic_ifstream : public basic_istream<_CharT, _Traits> ^ /usr/include/c++/4.8/fstream:427:11: note: no known conversion for argument 1 from 'long long int' to 'const std::basic_ifstream<char>&'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema pyk 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ă.