#2299
Se dau n numere naturale. Calculați media lor geometrică.
| Problema | media_geometrica | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64808660 | Utilizator | |
| Fișier | media_geometrica.cpp | Dimensiune | 281 B |
| Data încărcării | 02 Iunie 2026, 17:53 | Scor/rezultat | Eroare de compilare |
media_geometrica.cpp: In function ‘int main()’: media_geometrica.cpp:15:19: error: expected identifier before ‘float’ 15 | cout<<pow(p, [float]1/n); | ^~~~~ media_geometrica.cpp: In lambda function: media_geometrica.cpp:15:25: error: expected ‘{’ before numeric constant 15 | cout<<pow(p, [float]1/n); | ^ media_geometrica.cpp: In function ‘int main()’: media_geometrica.cpp:15:25: error: expected ‘)’ before numeric constant 15 | cout<<pow(p, [float]1/n); | ~ ^ | ) media_geometrica.cpp:15:14: error: no matching function for call to ‘pow(int&, main()::<lambda()>)’ 15 | cout<<pow(p, [float]1/n); | ~~~^~~~~~~~~~~~ In file included from media_geometrica.cpp:2: /usr/include/c++/13/cmath:1070:5: note: candidate: ‘template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)’ 1070 | pow(_Tp __x, _Up __y) | ^~~ /usr/include/c++/13/cmath:1070:5: note: template argument deduction/substitution failed: /usr/include/c++/13/cmath: In substitution of ‘template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up) [with _Tp = int; _Up = main()::<lambda()>]’: media_geometrica.cpp:15:14: required from here /usr/include/c++/13/cmath:1070:5: error: no type named ‘__type’ in ‘struct __gnu_cxx::__promote<main()::<lambda()>, false>’ In file included from /usr/include/features.h:502, from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679, from /usr/include/c++/13/bits/requires_hosted.h:31, from /usr/include/c++/13/iostream:38, from media_geometrica.cpp:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:140:1: note: candidate: ‘double pow(double, double)’ 140 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ In file included from /usr/include/c++/13/cmath:47: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:140:1: note: no known conversion for argument 2 from ‘main()::<lambda()>’ to ‘double’ 140 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^ /usr/include/c++/13/cmath:376:3: note: candidate: ‘constexpr long double std::pow(long double, long double)’ 376 | pow(long double __x, long double __y) | ^~~ /usr/include/c++/13/cmath:376:36: note: no known conversion for argument 2 from ‘main()::<lambda()>’ to ‘long double’ 376 | pow(long double __x, long double __y) | ~~~~~~~~~~~~^~~ /usr/include/c++/13/cmath:372:3: note: candidate: ‘constexpr float std::pow(float, float)’ 372 | pow(float __x, float __y) | ^~~ /usr/include/c++/13/cmath:372:24: note: no known conversion for argument 2 from ‘main()::<lambda()>’ to ‘float’ 372 | pow(float __x, float __y) | ~~~~~~^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema media_geometrica 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ă.