Se citește un număr natural n
. Să se determine suma divizorilor impari ai săi.
Problema | Suma Divizorilor Impari | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #37595889 | Utilizator | |
Fișier | suma_divizorilor_impari.cpp | Dimensiune | 4.59 KB |
Data încărcării | 13 Septembrie 2022, 08:26 | Scor / rezultat | Eroare de compilare |
suma_divizorilor_impari.cpp:1:7: error: expected nested-name-specifier before 'System' using System; ^ suma_divizorilor_impari.cpp:1:7: error: 'System' has not been declared suma_divizorilor_impari.cpp:2:7: error: expected nested-name-specifier before 'System' using System.Collections.Generic; ^ suma_divizorilor_impari.cpp:2:7: error: 'System' has not been declared suma_divizorilor_impari.cpp:2:13: error: expected ';' before '.' token using System.Collections.Generic; ^ suma_divizorilor_impari.cpp:2:13: error: expected unqualified-id before '.' token suma_divizorilor_impari.cpp:3:7: error: expected nested-name-specifier before 'System' using System.Linq; ^ suma_divizorilor_impari.cpp:3:7: error: 'System' has not been declared suma_divizorilor_impari.cpp:3:13: error: expected ';' before '.' token using System.Linq; ^ suma_divizorilor_impari.cpp:3:13: error: expected unqualified-id before '.' token suma_divizorilor_impari.cpp:4:7: error: expected nested-name-specifier before 'System' using System.Text; ^ suma_divizorilor_impari.cpp:4:7: error: 'System' has not been declared suma_divizorilor_impari.cpp:4:13: error: expected ';' before '.' token using System.Text; ^ suma_divizorilor_impari.cpp:4:13: error: expected unqualified-id before '.' token suma_divizorilor_impari.cpp:12:26: error: 'string' has not been declared static void Main(string[] args) ^ suma_divizorilor_impari.cpp:12:35: error: expected ',' or '...' before 'args' static void Main(string[] args) ^ suma_divizorilor_impari.cpp:20:17: error: expected ':' before 'static' private static void sumOfDivs() ^ suma_divizorilor_impari.cpp:45:17: error: expected ':' before 'static' private static void gcdOfArray() ^ suma_divizorilor_impari.cpp:63:17: error: expected ':' before 'static' private static int gcdWithDivision(int fNumber, int sNumber) ^ suma_divizorilor_impari.cpp:90:17: error: expected ':' before 'static' private static int gcdWithReduction(int fNumber, int sNumber) ^ suma_divizorilor_impari.cpp:106:17: error: expected ':' before 'static' private static int gcdOf2Numbers() ^ suma_divizorilor_impari.cpp:125:19: error: expected unqualified-id before '[' token static int[] stieveOfErathostenes(int n, int[] numbers, ref int index) ^ suma_divizorilor_impari.cpp:147:1: error: expected '}' at end of input } ^ suma_divizorilor_impari.cpp: In static member function 'static void Divizori::Program::sumOfDivs()': suma_divizorilor_impari.cpp:22:13: error: 'uint' was not declared in this scope uint sum = 0; ^ suma_divizorilor_impari.cpp:22:18: error: expected ';' before 'sum' uint sum = 0; ^ suma_divizorilor_impari.cpp:23:18: error: expected ';' before 'nr' uint nr = uint.Parse(Console.ReadLine()); ^ suma_divizorilor_impari.cpp:24:18: error: expected primary-expression before ']' token uint[] newArray = new uint[2000005]; ^ suma_divizorilor_impari.cpp:24:20: error: expected ';' before 'newArray' uint[] newArray = new uint[2000005]; ^ suma_divizorilor_impari.cpp:25:18: error: expected ';' before 'indexOfNewArray' uint indexOfNewArray = 0; ^ suma_divizorilor_impari.cpp:26:17: error: 'nr' was not declared in this scope if (nr == 1) { Console.WriteLine(1); return; }; ^ suma_divizorilor_impari.cpp:26:28: error: 'Console' was not declared in this scope if (nr == 1) { Console.WriteLine(1); return; }; ^ suma_divizorilor_impari.cpp:27:23: error: expected ';' before 'i' for (uint i = 1; i <= Math.Sqrt(nr); i++) { ^ suma_divizorilor_impari.cpp:27:30: error: 'i' was not declared in this scope for (uint i = 1; i <= Math.Sqrt(nr); i++) { ^ suma_divizorilor_impari.cpp:27:35: error: 'Math' was not declared in this scope for (uint i = 1; i <= Math.Sqrt(nr); i++) { ^ suma_divizorilor_impari.cpp:27:45: error: 'nr' was not declared in this scope for (uint i = 1; i <= Math.Sqrt(nr); i++) { ^ suma_divizorilor_impari.cpp:30:21: error: 'newArray' was not declared in this scope newArray[indexOfNewArray] = i; ^ suma_divizorilor_impari.cpp:30:30: error: 'indexOfNewArray' was not declared in this scope newArray[indexOfNewArray] = i; ^ suma_divizorilor_impari.cpp:34:23: error: expected ';' before 'i' for (uint i = 0; i < indexOfNewArray; i++) { ^ suma_divizorilor_impari.cpp:34:30: error: 'i' was not declared in this scope for (uint i = 0; i < indexOfNewArray; i++) { ^ suma_divizorilor_impari.cpp:34:34: error: 'indexOfNewArray' was not declared in this scope for (uint i = 0; i < indexOfNewArray; i++) { ^ suma_divizorilor_impari.cpp:35:21: error: 'nr' was not declared in this scope if (nr / newArray[i] % 2 == 1) ^ suma_divizorilor_impari.cpp:35:26: error: 'newArray' was not declared in this scope if (nr / newArray[i] % 2 == 1) ^ suma_divizorilor_impari.cpp:36:21: error: 'sum' was not declared in this scope sum += nr / newArray[i]; ^ suma_divizorilor_impari.cpp:37:20: error: 'newArray' was not declared in this scope if(newArray[i] % 2 == 1) ^ suma_divizorilor_impari.cpp:38:21: error: 'sum' was not declared in this scope sum += newArray[i]; ^ suma_divizorilor_impari.cpp:39:21: error: 'newArray' was not declared in this scope if (newArray[i] * newArray[i] == nr && newArray[i] % 2 == 1) ^ suma_divizorilor_impari.cpp:39:50: error: 'nr' was not declared in this scope if (newArray[i] * newArray[i] == nr && newArray[i] % 2 == 1) ^ suma_divizorilor_impari.cpp:40:21: error: 'sum' was not declared in this scope sum -= newArray[i]; ^ suma_divizorilor_impari.cpp:42:13: error: 'Console' was not declared in this scope Console.WriteLine(sum); ^ suma_divizorilor_impari.cpp:42:31: error: 'sum' was not declared in this scope Console.WriteLine(sum); ^ suma_divizorilor_impari.cpp: In static member function 'static void Divizori::Program::gcdOfArray()': suma_divizorilor_impari.cpp:47:13: error: 'Console' was not declared in this scope Console.WriteLine("Read n"); ^ suma_divizorilor_impari.cpp:48:31: error: expected primary-expression before 'int' int nrOfNumbers = int.Parse(Console.ReadLine()); ^ suma_divizorilor_impari.cpp:50:16: error: expected unqualified-id before '[' token int[] arrayOfNumbers = new int[nrOfNumbers + 1]; ^ suma_divizorilor_impari.cpp:53:17: error: 'arrayOfNumbers' was not declared in this scope arrayOfNumbers[index] = int.Parse(Console.ReadLine()); ^ suma_divizorilor_impari.cpp:53:41: error: expected primary-expression before 'int' arrayOfNumbers[index] = int.Parse(Console.ReadLine()); ^ suma_divizorilor_impari.cpp:53:41: error: expected ';' before 'int' suma_divizorilor_impari.cpp: In static member function 'static int Divizori::Program::gcdOf2Numbers()': suma_divizorilor_impari.cpp:109:17: error: expected primary-expression before 'int' a = int.Parse(Console.ReadLine()); ^ suma_divizorilor_impari.cpp:109:17: error: expected ';' before 'int' suma_divizorilor_impari.cpp:110:17: error: expected primary-expression before 'int' b = int.Parse(Console.ReadLine()); ^ suma_divizorilor_impari.cpp:110:17: error: expected ';' before 'int' suma_divizorilor_impari.cpp:111:13: error: 'Console' was not declared in this scope Console.WriteLine(gcdWithDivision(a, b)); ^ suma_divizorilor_impari.cpp: In static member function 'static void Divizori::Program::getPrimeNumbers()': suma_divizorilor_impari.cpp:115:26: error: expected primary-expression before 'int' int number = int.Parse(Console.ReadLine()); ^ suma_divizorilor_impari.cpp:116:16: error: expected unqualified-id before '[' token int[] primeNumbers = new int[number + 1]; ^ suma_divizorilor_impari.cpp:118:42: error: 'primeNumbers' was not declared in this scope stieveOfErathostenes(number, primeNumbers, ref nrPrimes); ^ suma_divizorilor_impari.cpp:118:56: error: 'ref' was not declared in this scope stieveOfErathostenes(number, primeNumbers, ref nrPrimes); ^ suma_divizorilor_impari.cpp:118:68: error: 'stieveOfErathostenes' was not declared in this scope stieveOfErathostenes(number, primeNumbers, ref nrPrimes); ^ suma_divizorilor_impari.cpp:121:17: error: 'Console' was not declared in this scope Console.WriteLine(primeNumbers[i]); ^ suma_divizorilor_impari.cpp: At global scope: suma_divizorilor_impari.cpp:124:9: error: expected unqualified-id at end of input } ^ suma_divizorilor_impari.cpp:124:9: error: expected '}' at end of input
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Suma Divizorilor Impari 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ă.