#922
Puncte
Se dau coordonatele carteziene a n
puncte în plan. Să se determine distanța maximă dintre un punct dat și originea sistemului de coordonate și numărul de puncte situate la acea distanță față de origine.
Problema | Puncte | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #38819362 | Utilizator | |
Fișier | puncte.cpp | Dimensiune | 1.66 KB |
Data încărcării | 18 Octombrie 2022, 10:02 | Scor / rezultat | Eroare de compilare |
puncte.cpp:1:7: error: expected nested-name-specifier before 'System' using System; ^ puncte.cpp:1:7: error: 'System' has not been declared puncte.cpp:9:21: error: expected ':' before 'double' private double x, y; ^ puncte.cpp:11:20: error: expected ':' before 'punct' public punct() ^ puncte.cpp:16:20: error: expected ':' before 'punct' public punct(double x, double y) ^ puncte.cpp:22:20: error: expected ':' before 'punct' public punct(punct p) ^ puncte.cpp:22:33: error: invalid constructor; you probably meant '_922_puncte::Program::punct (const _922_puncte::Program::punct&)' public punct(punct p) ^ puncte.cpp:28:20: error: expected ':' before 'double' public double dist() ^ puncte.cpp:33:20: error: expected ':' before 'double' public double dist(punct p) ^ puncte.cpp:38:20: error: expected ':' before 'void' public void citire() ^ puncte.cpp:45:20: error: expected ':' before 'override' public override string ToString() ^ puncte.cpp:45:20: error: 'override' does not name a type puncte.cpp:49:9: error: expected ';' after class definition } ^ puncte.cpp:51:26: error: 'string' has not been declared static void Main(string[] args) ^ puncte.cpp:51:35: error: expected ',' or '...' before 'args' static void Main(string[] args) ^ puncte.cpp:68:5: error: expected ';' after class definition } ^ puncte.cpp: In constructor '_922_puncte::Program::punct::punct(double, double)': puncte.cpp:18:22: error: request for member 'x' in 'this', which is of pointer type '_922_puncte::Program::punct* const' (maybe you meant to use '->' ?) this.x = x; ^ puncte.cpp:19:22: error: request for member 'y' in 'this', which is of pointer type '_922_puncte::Program::punct* const' (maybe you meant to use '->' ?) this.y = y; ^ puncte.cpp: In member function 'double _922_puncte::Program::punct::dist()': puncte.cpp:30:24: error: 'Math' was not declared in this scope return Math.Sqrt(x * x + y * y); ^ puncte.cpp: In member function 'double _922_puncte::Program::punct::dist(_922_puncte::Program::punct)': puncte.cpp:35:24: error: 'Math' was not declared in this scope return Math.Sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y)); ^ puncte.cpp: In member function 'void _922_puncte::Program::punct::citire()': puncte.cpp:40:17: error: 'string' was not declared in this scope string[] S = Console.ReadLine().Split(); ^ puncte.cpp:40:24: error: expected primary-expression before ']' token string[] S = Console.ReadLine().Split(); ^ puncte.cpp:40:26: error: expected ';' before 'S' string[] S = Console.ReadLine().Split(); ^ puncte.cpp:41:21: error: expected primary-expression before 'double' x = double.Parse(S[0]); ^ puncte.cpp:41:21: error: expected ';' before 'double' puncte.cpp:42:21: error: expected primary-expression before 'double' y = double.Parse(S[1]); ^ puncte.cpp:42:21: error: expected ';' before 'double' puncte.cpp: In static member function 'static void _922_puncte::Program::Main(int*)': puncte.cpp:53:19: error: expected primary-expression before 'int' int n=int.Parse(Console.ReadLine()); ^ puncte.cpp:54:18: error: expected unqualified-id before '[' token punct[] P=new punct[n]; ^ puncte.cpp:56:17: error: 'P' was not declared in this scope P[i] = new punct(); ^ puncte.cpp:58:17: error: 'P' was not declared in this scope P[i].citire(); ^ puncte.cpp:60:28: error: expected primary-expression before 'p' foreach (punct p in P) ^ puncte.cpp:60:34: error: 'foreach' was not declared in this scope foreach (punct p in P) ^ puncte.cpp:61:17: error: expected ';' before 'if' if (p.dist() > dmax) dmax = p.dist(); ^ puncte.cpp:62:13: error: 'Console' was not declared in this scope Console.Write(dmax + " "); ^ puncte.cpp:62:34: error: invalid operands of types 'double' and 'const char [2]' to binary 'operator+' Console.Write(dmax + " "); ^ puncte.cpp:64:28: error: expected primary-expression before 'p' foreach (punct p in P) ^ puncte.cpp:65:17: error: expected ';' before 'if' if (p.dist() == dmax) c++; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Puncte 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ă.