Detalii evaluare #54016328

Rezumat problemă

#2433 cufar

Vrăjitoarea cea bună are un cufăr în care este închisă piatra magică de către piticii lăzii cu ajutorul unui cifru digital. Piticii i-au dat vrăjitoarei o cutie în care sunt n cartonașe. Pe fiecare cartonaș este scris un număr natural pe care vrăjitoarea îl va folosi să deschidă lada. Valorile scrise pe cartonașe sunt distincte între ele.
Pentru a afla cifrul trebuie să procedeze astfel: extrage fiecare cartonaș din cutie și apoi determină valoarea magică asociată numărului natural scris pe cartonaș. Pentru fiecare cartonaș valoarea magică este dată de al k-lea divizor prim al numărului înscris pe acesta. Vrăjitoarea trebuie să adune valorile magice obținute pentru cele n cartonașe și apoi să introducă în ordine cifrele valorii obținute, pentru a descuia lada. Deoarece vrăjitoarea nu are timp la dispoziție vă roagă pe voi să o ajutați să rezolve următoarele probleme:
1. Să afle valoarea magică pentru un cartonaș dat;
2. Să afle cifrul cufărului.

Detalii

Problema cufar Operații I/O cufar.in/cufar.out
Limita timp 0.5 secunde Limita memorie Total: 128 MB / Stivă 32 MB
Id soluție #54016328 Utilizator a b (SamNate)
Fișier cufar.cpp Dimensiune 8.76 KB
Data încărcării 17 Noiembrie 2024, 23:21 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

cufar.cpp:370:7: error: "pion" is not a valid filename
 #3245 pion

       ^
cufar.cpp:41:13: error: redefinition of 'std::ifstream fin'
 ifstream fin("sumtri_xi.in");

             ^
cufar.cpp:6:10: error: 'std::ifstream fin' previously declared here
 ifstream fin("cladire1.in");

          ^
cufar.cpp:42:14: error: redefinition of 'std::ofstream fout'
 ofstream fout("sumtri_xi.out");

              ^
cufar.cpp:7:10: error: 'std::ofstream fout' previously declared here
 ofstream fout("cladire1.out");

          ^
cufar.cpp: In function 'int main()':
cufar.cpp:46:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^
cufar.cpp: At global scope:
cufar.cpp:79:14: error: redefinition of 'std::ifstream fin'
 ifstream fin ("livada_xi.in");

              ^
cufar.cpp:6:10: error: 'std::ifstream fin' previously declared here
 ifstream fin("cladire1.in");

          ^
cufar.cpp:80:15: error: redefinition of 'std::ofstream fout'
 ofstream fout ("livada_xi.out");

               ^
cufar.cpp:7:10: error: 'std::ofstream fout' previously declared here
 ofstream fout("cladire1.out");

          ^
cufar.cpp:82:5: error: redefinition of 'int n'
 int n;

     ^
cufar.cpp:44:5: error: 'int n' previously declared here
 int n, v[101][101], s[101][101];

     ^
cufar.cpp:84:15: error: redefinition of 'int s [101][101]'
 int s[101][101];

               ^
cufar.cpp:44:21: error: 'int s [101][101]' previously declared here
 int n, v[101][101], s[101][101];

                     ^
cufar.cpp: In function 'int main()':
cufar.cpp:86:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^
cufar.cpp: At global scope:
cufar.cpp:118:13: error: redefinition of 'std::ifstream fin'
 ifstream fin("alice_xi.in");

             ^
cufar.cpp:6:10: error: 'std::ifstream fin' previously declared here
 ifstream fin("cladire1.in");

          ^
cufar.cpp:119:14: error: redefinition of 'std::ofstream fout'
 ofstream fout("alice_xi.out");

              ^
cufar.cpp:7:10: error: 'std::ofstream fout' previously declared here
 ofstream fout("cladire1.out");

          ^
cufar.cpp:123:11: error: conflicting declaration 'long long int n'
 long long n, A[101][101], s;

           ^
cufar.cpp:44:5: error: 'n' has a previous declaration as 'int n'
 int n, v[101][101], s[101][101];

     ^
cufar.cpp:123:24: error: conflicting declaration 'long long int A [101][101]'
 long long n, A[101][101], s;

                        ^
cufar.cpp:11:5: error: 'A' has a previous declaration as 'int A [1001][1001]'
 int A[1001][1001];

     ^
cufar.cpp:123:27: error: conflicting declaration 'long long int s'
 long long n, A[101][101], s;

                           ^
cufar.cpp:44:21: error: 's' has a previous declaration as 'int s [101][101]'
 int n, v[101][101], s[101][101];

                     ^
cufar.cpp: In function 'int main()':
cufar.cpp:125:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^
cufar.cpp:141:6: error: incompatible types in assignment of 'int' to 'int [101][101]'
     s+=A[n][i];

      ^
cufar.cpp: At global scope:
cufar.cpp:156:13: error: redefinition of 'std::ifstream fin'
 ifstream fin("sumtri1.in");

             ^
cufar.cpp:6:10: error: 'std::ifstream fin' previously declared here
 ifstream fin("cladire1.in");

          ^
cufar.cpp:157:14: error: redefinition of 'std::ofstream fout'
 ofstream fout("sumtri1.out");

              ^
cufar.cpp:7:10: error: 'std::ofstream fout' previously declared here
 ofstream fout("cladire1.out");

          ^
cufar.cpp:159:5: error: redefinition of 'int n'
 int n;

     ^
cufar.cpp:44:5: error: 'int n' previously declared here
 int n, v[101][101], s[101][101];

     ^
cufar.cpp:161:15: error: conflicting declaration 'int s [102][102]'
 int s[102][102];

               ^
cufar.cpp:44:21: error: 's' has a previous declaration as 'int s [101][101]'
 int n, v[101][101], s[101][101];

                     ^
cufar.cpp: In function 'int main()':
cufar.cpp:164:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^
cufar.cpp: At global scope:
cufar.cpp:213:13: error: redefinition of 'std::ifstream fin'
 ifstream fin("pacman_xi.in");

             ^
cufar.cpp:6:10: error: 'std::ifstream fin' previously declared here
 ifstream fin("cladire1.in");

          ^
cufar.cpp:214:14: error: redefinition of 'std::ofstream fout'
 ofstream fout("pacman_xi.out");

              ^
cufar.cpp:7:10: error: 'std::ofstream fout' previously declared here
 ofstream fout("cladire1.out");

          ^
cufar.cpp:216:25: error: conflicting declaration 'long long int A [101][101]'
 long long int A[101][101];

                         ^
cufar.cpp:11:5: error: 'A' has a previous declaration as 'int A [1001][1001]'
 int A[1001][1001];

     ^
cufar.cpp: In function 'int main()':
cufar.cpp:218:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^
cufar.cpp: At global scope:
cufar.cpp:248:13: error: redefinition of 'std::ifstream fin'
 ifstream fin("cladire.in");

             ^
cufar.cpp:6:10: error: 'std::ifstream fin' previously declared here
 ifstream fin("cladire1.in");

          ^
cufar.cpp:249:14: error: redefinition of 'std::ofstream fout'
 ofstream fout("cladire.out");

              ^
cufar.cpp:7:10: error: 'std::ofstream fout' previously declared here
 ofstream fout("cladire1.out");

          ^
cufar.cpp: In function 'int main()':
cufar.cpp:251:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^
cufar.cpp: At global scope:
cufar.cpp:273:14: error: redefinition of 'std::ifstream fin'
 ifstream fin ("spectacole.in");

              ^
cufar.cpp:6:10: error: 'std::ifstream fin' previously declared here
 ifstream fin("cladire1.in");

          ^
cufar.cpp:274:15: error: redefinition of 'std::ofstream fout'
 ofstream fout ("spectacole.out");

               ^
cufar.cpp:7:10: error: 'std::ofstream fout' previously declared here
 ofstream fout("cladire1.out");

          ^
cufar.cpp: In function 'int main()':
cufar.cpp:292:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^
cufar.cpp: At global scope:
cufar.cpp:326:14: error: redefinition of 'std::ifstream fin'
 ifstream fin ("cladire5.in");

              ^
cufar.cpp:6:10: error: 'std::ifstream fin' previously declared here
 ifstream fin("cladire1.in");

          ^
cufar.cpp:327:15: error: redefinition of 'std::ofstream fout'
 ofstream fout ("cladire5.out");

               ^
cufar.cpp:7:10: error: 'std::ofstream fout' previously declared here
 ofstream fout("cladire1.out");

          ^
cufar.cpp:329:5: error: redefinition of 'int n'
 int n,m;

     ^
cufar.cpp:44:5: error: 'int n' previously declared here
 int n, v[101][101], s[101][101];

     ^
cufar.cpp:329:7: error: conflicting declaration 'int m'
 int n,m;

       ^
cufar.cpp:83:5: error: 'm' has a previous declaration as 'int m [101][101]'
 int m[101][101];

     ^
cufar.cpp:330:15: error: conflicting declaration 'int s [202][202]'
 int s[202][202];

               ^
cufar.cpp:44:21: error: 's' has a previous declaration as 'int s [101][101]'
 int n, v[101][101], s[101][101];

                     ^
cufar.cpp: In function 'int main()':
cufar.cpp:334:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^
cufar.cpp:338:9: error: cannot bind 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&'
     fin >> n >> m >> S;

         ^
In file included from /usr/include/c++/4.8/sstream:38:0,
                 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 cufar.cpp:1:
/usr/include/c++/4.8/istream:872:5: error:   initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = int [101][101]]'
     operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
     ^
cufar.cpp:340:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
         for ( int j = 1; j <= m; ++j)

                               ^
cufar.cpp:349:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
     for ( int i = 1; i <= m; ++i)

                           ^
cufar.cpp:353:17: error: invalid types 'int [202][int (*)[101]]' for array subscript
         p[i][m+1] = inf;                /// coloana de dupa ultima

                 ^
cufar.cpp:356:11: error: invalid types 'int [202][int [101][101]]' for array subscript
     p[0][m] = 0;

           ^
cufar.cpp:359:23: error: invalid conversion from 'int (*)[101]' to 'int' [-fpermissive]
         for ( int j = m; j >= 1; --j)

                       ^
cufar.cpp: At global scope:
cufar.cpp:378:5: error: redefinition of 'int n'
 int n;

     ^
cufar.cpp:44:5: error: 'int n' previously declared here
 int n, v[101][101], s[101][101];

     ^
cufar.cpp:379:15: error: conflicting declaration 'int m [102][102]'
 int m[102][102] = {{0}};

               ^
cufar.cpp:83:5: error: 'm' has a previous declaration as 'int m [101][101]'
 int m[101][101];

     ^
cufar.cpp:380:15: error: conflicting declaration 'int s [102][102]'
 int s[102][102] = {{0}};

               ^
cufar.cpp:44:21: error: 's' has a previous declaration as 'int s [101][101]'
 int n, v[101][101], s[101][101];

                     ^
cufar.cpp: In function 'int main()':
cufar.cpp:382:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^
cufar.cpp: At global scope:
cufar.cpp:422:14: error: redefinition of 'std::ifstream fin'
 ifstream fin ("spectacole.in");

              ^
cufar.cpp:6:10: error: 'std::ifstream fin' previously declared here
 ifstream fin("cladire1.in");

          ^
cufar.cpp:423:15: error: redefinition of 'std::ofstream fout'
 ofstream fout ("spectacole.out");

               ^
cufar.cpp:7:10: error: 'std::ofstream fout' previously declared here
 ofstream fout("cladire1.out");

          ^
cufar.cpp:425:8: error: redefinition of 'struct Spectacol'
 struct Spectacol

        ^
cufar.cpp:276:8: error: previous definition of 'struct Spectacol'
 struct Spectacol

        ^
cufar.cpp:432:24: error: redefinition of 'Spectacol spectacol [101]'
 Spectacol spectacol[101];

                        ^
cufar.cpp:283:11: error: 'Spectacol spectacol [101]' previously declared here
 Spectacol spectacol[101];

           ^
cufar.cpp:433:5: error: redefinition of 'int nrsp'
 int nrsp;

     ^
cufar.cpp:284:5: error: 'int nrsp' previously declared here
 int nrsp;

     ^
cufar.cpp: In function 'bool Maimic(Spectacol, Spectacol)':
cufar.cpp:436:6: error: redefinition of 'bool Maimic(Spectacol, Spectacol)'
 bool Maimic (Spectacol a, Spectacol b)

      ^
cufar.cpp:287:6: error: 'bool Maimic(Spectacol, Spectacol)' previously defined here
 bool Maimic (Spectacol a, Spectacol b)

      ^
cufar.cpp: In function 'int main()':
cufar.cpp:441:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^
cufar.cpp: At global scope:
cufar.cpp:474:13: error: redefinition of 'std::ifstream fin'
 ifstream fin("obiecte.in");

             ^
cufar.cpp:6:10: error: 'std::ifstream fin' previously declared here
 ifstream fin("cladire1.in");

          ^
cufar.cpp:492:5: error: redefinition of 'int n'
 int n;

     ^
cufar.cpp:44:5: error: 'int n' previously declared here
 int n, v[101][101], s[101][101];

     ^
cufar.cpp: In function 'int main()':
cufar.cpp:496:5: error: redefinition of 'int main()'
 int main()

     ^
cufar.cpp:13:5: error: 'int main()' previously defined here
 int main()

     ^

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