Detalii evaluare #50721479

Rezumat problemă

#2392 SumaXL

Se dau două numere, unul mare și unul mic, ambele pozitive. Calculați suma lor.

Detalii

Problema SumaXL Operații I/O sumaxl.in/sumaxl.out
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #50721479 Utilizator Manolea Stefan (StefanManolea)
Fișier sumaxl.cpp Dimensiune 6.15 KB
Data încărcării 24 Aprilie 2024, 20:59 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

sumaxl.cpp:1:24: error: missing terminating > character
 #include <bits/stdc++.h

                        ^
sumaxl.cpp:3:10: error: expected unqualified-id before 'namespace'
 unsigned namespace std;

          ^
sumaxl.cpp:5:1: error: 'ifstream' does not name a type
 ifstream fin ("sumaxl.in");

 ^
sumaxl.cpp:6:1: error: 'ofstream' does not name a type
 ofstream fout ("sumaxl.out");

 ^
sumaxl.cpp:12:5: error: 'vector' does not name a type
     vector<int> number;

     ^
sumaxl.cpp:58:19: error: 'string' does not name a type
     bigInt (const string& str) {

                   ^
sumaxl.cpp:58:27: error: ISO C++ forbids declaration of 'str' with no type [-fpermissive]
     bigInt (const string& str) {

                           ^
sumaxl.cpp:62:19: error: 'vector' does not name a type
     bigInt (const vector<int>& v) {

                   ^
sumaxl.cpp:62:19: error: ISO C++ forbids declaration of 'parameter' with no type [-fpermissive]
sumaxl.cpp:62:25: error: expected ',' or '...' before '<' token
     bigInt (const vector<int>& v) {

                         ^
sumaxl.cpp:70:5: error: 'bigInt::bigInt(int)' cannot be overloaded
     bigInt (const int sn) {

     ^
sumaxl.cpp:62:5: error: with 'bigInt::bigInt(int)'
     bigInt (const vector<int>& v) {

     ^
sumaxl.cpp:78:21: error: 'string' does not name a type
     void init(const string& str) {

                     ^
sumaxl.cpp:78:29: error: ISO C++ forbids declaration of 'str' with no type [-fpermissive]
     void init(const string& str) {

                             ^
sumaxl.cpp:85:22: error: 'vector' does not name a type
     void init (const vector<int>& v) {

                      ^
sumaxl.cpp:85:22: error: ISO C++ forbids declaration of 'parameter' with no type [-fpermissive]
sumaxl.cpp:85:28: error: expected ',' or '...' before '<' token
     void init (const vector<int>& v) {

                            ^
sumaxl.cpp:91:10: error: 'void bigInt::init(int)' cannot be overloaded
     void init (int sn) {

          ^
sumaxl.cpp:85:10: error: with 'void bigInt::init(int)'
     void init (const vector<int>& v) {

          ^
sumaxl.cpp:217:12: error: 'istream' does not name a type
     friend istream& operator>> (istream& is, bigInt& bn) {

            ^
sumaxl.cpp:223:12: error: 'ostream' does not name a type
     friend ostream& operator<< (ostream& os, const bigInt& val) {

            ^
sumaxl.cpp: In member function 'size_t bigInt::size()':
sumaxl.cpp:16:22: error: 'struct bigInt' has no member named 'number'
         return this->number.size();

                      ^
sumaxl.cpp: In member function 'void bigInt::clear()':
sumaxl.cpp:20:15: error: 'struct bigInt' has no member named 'number'
         this->number.clear();

               ^
sumaxl.cpp: In member function 'int& bigInt::operator[](int)':
sumaxl.cpp:24:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (index >= this->size()) {

                                 ^
sumaxl.cpp:25:13: error: 'cout' was not declared in this scope
             cout << "TRYING TO ACCESS INVALID ADDRESS";

             ^
sumaxl.cpp:25:13: note: suggested alternative:
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from sumaxl.cpp:1:
/usr/include/c++/4.8/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
sumaxl.cpp:28:22: error: 'struct bigInt' has no member named 'number'
         return this->number[this->size() - index - 1];

                      ^
sumaxl.cpp: In member function 'int bigInt::operator[](int) const':
sumaxl.cpp:32:28: error: 'const struct bigInt' has no member named 'number'
         if (index >= this->number.size()) {

                            ^
sumaxl.cpp:33:13: error: 'cout' was not declared in this scope
             cout << "TRYING TO ACCESS INVALID ADDRESS";

             ^
sumaxl.cpp:33:13: note: suggested alternative:
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from sumaxl.cpp:1:
/usr/include/c++/4.8/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
sumaxl.cpp:36:22: error: 'const struct bigInt' has no member named 'number'
         return this->number[this->number.size() - index - 1];

                      ^
sumaxl.cpp:36:35: error: 'const struct bigInt' has no member named 'number'
         return this->number[this->number.size() - index - 1];

                                   ^
sumaxl.cpp: In member function 'int& bigInt::at(int)':
sumaxl.cpp:40:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (index >= this->size()) {

                                 ^
sumaxl.cpp:41:13: error: 'cout' was not declared in this scope
             cout << "TRYING TO ACCESS INVALID ADDRESS";

             ^
sumaxl.cpp:41:13: note: suggested alternative:
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from sumaxl.cpp:1:
/usr/include/c++/4.8/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
sumaxl.cpp:44:22: error: 'struct bigInt' has no member named 'number'
         return this->number[this->size() - index - 1];

                      ^
sumaxl.cpp: In member function 'int bigInt::at(int) const':
sumaxl.cpp:48:28: error: 'const struct bigInt' has no member named 'number'
         if (index >= this->number.size()) {

                            ^
sumaxl.cpp:49:13: error: 'cout' was not declared in this scope
             cout << "TRYING TO ACCESS INVALID ADDRESS";

             ^
sumaxl.cpp:49:13: note: suggested alternative:
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from sumaxl.cpp:1:
/usr/include/c++/4.8/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
sumaxl.cpp:52:22: error: 'const struct bigInt' has no member named 'number'
         return this->number[this->number.size() - index - 1];

                      ^
sumaxl.cpp:52:35: error: 'const struct bigInt' has no member named 'number'
         return this->number[this->number.size() - index - 1];

                                   ^
sumaxl.cpp: In constructor 'bigInt::bigInt(const int&)':
sumaxl.cpp:59:23: error: call of overloaded 'init(const int&)' is ambiguous
         this->init(str);

                       ^
sumaxl.cpp:59:23: note: candidates are:
sumaxl.cpp:78:10: note: void bigInt::init(const int&)
     void init(const string& str) {

          ^
sumaxl.cpp:85:10: note: void bigInt::init(int)
     void init (const vector<int>& v) {

          ^
sumaxl.cpp: In constructor 'bigInt::bigInt(int)':
sumaxl.cpp:63:20: error: 'v' was not declared in this scope
         this->init(v);

                    ^
sumaxl.cpp: In constructor 'bigInt::bigInt(int)':
sumaxl.cpp:71:22: error: call of overloaded 'init(const int&)' is ambiguous
         this->init(sn);

                      ^
sumaxl.cpp:71:22: note: candidates are:
sumaxl.cpp:78:10: note: void bigInt::init(const int&)
     void init(const string& str) {

          ^
sumaxl.cpp:85:10: note: void bigInt::init(int)
     void init (const vector<int>& v) {

          ^
sumaxl.cpp: In member function 'void bigInt::init(const int&)':
sumaxl.cpp:79:15: error: 'struct bigInt' has no member named 'number'
         this->number.clear();

               ^
sumaxl.cpp:80:28: error: request for member 'rbegin' in 'str', which is of non-class type 'const int'
         for (auto it = str.rbegin(); it != str.crend(); it++) {

                            ^
sumaxl.cpp:80:48: error: request for member 'crend' in 'str', which is of non-class type 'const int'
         for (auto it = str.rbegin(); it != str.crend(); it++) {

                                                ^
sumaxl.cpp:81:19: error: 'struct bigInt' has no member named 'number'
             this->number.push_back(*it - '0');

                   ^
sumaxl.cpp: In member function 'void bigInt::init(int)':
sumaxl.cpp:86:15: error: 'struct bigInt' has no member named 'number'
         this->number.clear();

               ^
sumaxl.cpp:87:24: error: 'v' was not declared in this scope
         for (auto it = v.rbegin(); it != v.crend(); it++) {

                        ^
sumaxl.cpp:88:19: error: 'struct bigInt' has no member named 'number'
             this->number.push_back(*it);

                   ^
sumaxl.cpp: In member function 'void bigInt::init(int)':
sumaxl.cpp:92:15: error: 'struct bigInt' has no member named 'number'
         this->number.clear();

               ^
sumaxl.cpp:94:19: error: 'struct bigInt' has no member named 'number'
             this->number.push_back(sn%10);

                   ^
sumaxl.cpp: In member function 'bigInt bigInt::addition(bigInt&)':
sumaxl.cpp:105:57: error: 'min' was not declared in this scope
         const int limitA = min(this->size(),other.size());

                                                         ^
sumaxl.cpp:105:57: note: suggested alternative:
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64,
                 from sumaxl.cpp:1:
/usr/include/c++/4.8/bits/stl_algo.h:4226:5: note:   'std::min'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^
sumaxl.cpp:106:58: error: 'max' was not declared in this scope
         const int limitB = max(this->size(), other.size());

                                                          ^
sumaxl.cpp:106:58: note: suggested alternative:
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64,
                 from sumaxl.cpp:1:
/usr/include/c++/4.8/bits/stl_algo.h:4236:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
sumaxl.cpp:107:13: error: 'struct bigInt' has no member named 'number'
         ret.number.resize(limitB);

             ^
sumaxl.cpp:111:28: error: 'struct bigInt' has no member named 'number'
             extra += this->number[i] + other.number[i];

                            ^
sumaxl.cpp:111:46: error: 'struct bigInt' has no member named 'number'
             extra += this->number[i] + other.number[i];

                                              ^
sumaxl.cpp:112:17: error: 'struct bigInt' has no member named 'number'
             ret.number[i] = extra % 10;

                 ^
sumaxl.cpp:116:28: error: 'struct bigInt' has no member named 'number'
             extra += this->number[i];

                            ^
sumaxl.cpp:117:17: error: 'struct bigInt' has no member named 'number'
             ret.number[i] = extra % 10;

                 ^
sumaxl.cpp:122:17: error: 'struct bigInt' has no member named 'number'
             ret.number.push_back(extra);

                 ^
sumaxl.cpp: In member function 'bigInt bigInt::addition(int)':
sumaxl.cpp:126:27: error: call of overloaded 'bigInt(const int&)' is ambiguous
         bigInt extra(other);

                           ^
sumaxl.cpp:126:27: note: candidates are:
sumaxl.cpp:66:5: note: bigInt::bigInt(const bigInt&)
     bigInt (const bigInt& bn) {

     ^
sumaxl.cpp:62:5: note: bigInt::bigInt(int)
     bigInt (const vector<int>& v) {

     ^
sumaxl.cpp:58:5: note: bigInt::bigInt(const int&)
     bigInt (const string& str) {

     ^
sumaxl.cpp: In member function 'bigInt bigInt::subtraction(bigInt&)':
sumaxl.cpp:135:57: error: 'min' was not declared in this scope
         const int limitA = min(this->size(),other.size());

                                                         ^
sumaxl.cpp:135:57: note: suggested alternative:
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64,
                 from sumaxl.cpp:1:
/usr/include/c++/4.8/bits/stl_algo.h:4226:5: note:   'std::min'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^
sumaxl.cpp:136:57: error: 'max' was not declared in this scope
         const int limitB = max(this->size(),other.size());

                                                         ^
sumaxl.cpp:136:57: note: suggested alternative:
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64,
                 from sumaxl.cpp:1:
/usr/include/c++/4.8/bits/stl_algo.h:4236:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
sumaxl.cpp:137:13: error: 'struct bigInt' has no member named 'number'
         ret.number.resize(limitB);

             ^
sumaxl.cpp:141:27: error: 'struct bigInt' has no member named 'number'
             extra = this->number[i] - other.number[i];

                           ^
sumaxl.cpp:141:45: error: 'struct bigInt' has no member named 'number'
             extra = this->number[i] - other.number[i];

                                             ^
sumaxl.cpp:144:23: error: 'struct bigInt' has no member named 'number'
                 this->number[i+1]--;

                       ^
sumaxl.cpp:146:17: error: 'struct bigInt' has no member named 'number'
             ret.number[i] = extra;

                 ^
sumaxl.cpp:149:27: error: 'struct bigInt' has no member named 'number'
             extra = this->number[i];

                           ^
sumaxl.cpp:152:23: error: 'struct bigInt' has no member named 'number'
                 this->number[i+1]--;

                       ^
sumaxl.cpp:154:17: error: 'struct bigInt' has no member named 'number'
             ret.number[i] = extra;

                 ^
sumaxl.cpp:157:20: error: 'struct bigInt' has no member named 'number'
         while (ret.number.back() == 0 && ret.size() > 1)

                    ^
sumaxl.cpp:158:17: error: 'struct bigInt' has no member named 'number'
             ret.number.pop_back();

                 ^
sumaxl.cpp: In member function 'bigInt bigInt::subtraction(int)':
sumaxl.cpp:162:27: error: call of overloaded 'bigInt(const int&)' is ambiguous
         bigInt extra(other);

                           ^
sumaxl.cpp:162:27: note: candidates are:
sumaxl.cpp:66:5: note: bigInt::bigInt(const bigInt&)
     bigInt (const bigInt& bn) {

     ^
sumaxl.cpp:62:5: note: bigInt::bigInt(int)
     bigInt (const vector<int>& v) {

     ^
sumaxl.cpp:58:5: note: bigInt::bigInt(const int&)
     bigInt (const string& str) {

     ^
sumaxl.cpp: In member function 'bigInt bigInt::multiplication(int)':
sumaxl.cpp:173:28: error: 'struct bigInt' has no member named 'number'
             extra += this->number[i] * sn;

                            ^
sumaxl.cpp:174:17: error: 'struct bigInt' has no member named 'number'
             ret.number.push_back(extra%10);

                 ^
sumaxl.cpp:178:17: error: 'struct bigInt' has no member named 'number'
             ret.number.push_back(extra%10);

                 ^
sumaxl.cpp: In member function 'bigInt bigInt::division(int)':
sumaxl.cpp:194:21: error: 'struct bigInt' has no member named 'number'
                 ret.number.push_back(calc);

                     ^
sumaxl.cpp: In member function 'bigInt bigInt::remainder(int)':
sumaxl.cpp:207:17: error: 'struct bigInt' has no member named 'number'
             ret.number.push_back(extra / sn);

                 ^
sumaxl.cpp:210:23: error: call of overloaded 'init(int&)' is ambiguous
         ret.init(extra);

                       ^
sumaxl.cpp:210:23: note: candidates are:
sumaxl.cpp:78:10: note: void bigInt::init(const int&)
     void init(const string& str) {

          ^
sumaxl.cpp:85:10: note: void bigInt::init(int)
     void init (const vector<int>& v) {

          ^
sumaxl.cpp:212:17: error: 'struct bigInt' has no member named 'number'
             ret.number.push_back(0);

                 ^
sumaxl.cpp: In function 'int main()':
sumaxl.cpp:232:5: error: 'string' was not declared in this scope
     string number;

     ^
sumaxl.cpp:232:5: note: suggested alternative:
In file included from /usr/include/c++/4.8/iosfwd:39:0,
                 from /usr/include/c++/4.8/ios:38,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/sstream:38,
                 from /usr/include/c++/4.8/complex:45,
                 from /usr/include/c++/4.8/ccomplex:38,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from sumaxl.cpp:1:
/usr/include/c++/4.8/bits/stringfwd.h:62:33: note:   'std::string'
   typedef basic_string<char>    string;   
                                 ^
sumaxl.cpp:232:12: error: expected ';' before 'number'
     string number;

            ^
sumaxl.cpp:234:2: error: 'fin' was not declared in this scope
  fin >> n;

  ^
sumaxl.cpp:236:10: error: expected ';' before 'ch'
   string ch;

          ^
sumaxl.cpp:237:16: error: 'ch' was not declared in this scope
         fin >> ch;

                ^
sumaxl.cpp:238:3: error: 'number' was not declared in this scope
   number += ch;

   ^
sumaxl.cpp:240:12: error: 'number' was not declared in this scope
     a.init(number);

            ^
sumaxl.cpp:243:5: error: 'fout' was not declared in this scope
     fout << a;

     ^
sumaxl.cpp: In member function 'size_t bigInt::size()':
sumaxl.cpp:17:5: warning: control reaches end of non-void function [-Wreturn-type]
     }

     ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema SumaXL face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.