#4707
nkd
Se consideră trei numere naturale n
, k
și d
. Să se determine cel mai mic număr natural care se poate obține prin interschimbarea ultimelor k
cifre ale lui n
astfel încât numărul obținut să fie divizibil cu d
.
Concursul Judetean XOR 2014
Problema | nkd | Operații I/O |
nkd.in /nkd.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 4 MB
/
Stivă 1 MB
|
Id soluție | #55037712 | Utilizator | |
Fișier | nkd.cpp | Dimensiune | 867 B |
Data încărcării | 17 Decembrie 2024, 19:24 | Scor / rezultat | Eroare de compilare |
nkd.cpp:33:26: warning: multi-character character constant [-Wmultichar] while(ln>=ln-k)n[ln]='/0', ln--; ^ nkd.cpp: In function 'int rest(char*, int)': nkd.cpp:12:25: error: 'int rest(char*, int)' redeclared as different kind of symbol int rest(char p[], int r) ^ nkd.cpp:10:25: error: previous declaration of 'int rest' int k, d, i, j, ln, ls, rest, ok; ^ nkd.cpp:19:9: error: expected ';' before 'rrest' rrest=rrest%d; ^ nkd.cpp:23:25: error: 'dl' was not declared in this scope return (10*rrest+r)%dl ^ nkd.cpp:24:1: error: expected ';' before '}' token } ^ nkd.cpp: In function 'int main()': nkd.cpp:33:25: warning: overflow in implicit constant conversion [-Woverflow] while(ln>=ln-k)n[ln]='/0', ln--; ^ nkd.cpp:36:20: error: 'rest' cannot be used as a function int R=rest(n, 0); ^ nkd.cpp:40:23: error: 'rest' cannot be used as a function if(rest(sol, R)%d)next_permutation(sol); ^ nkd.cpp:40:47: error: no matching function for call to 'next_permutation(char [10005])' if(rest(sol, R)%d)next_permutation(sol); ^ nkd.cpp:40:47: note: candidates are: 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 nkd.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:3654:5: note: template<class _BIter> bool std::next_permutation(_BIter, _BIter) next_permutation(_BidirectionalIterator __first, ^ /usr/include/c++/4.8/bits/stl_algo.h:3654:5: note: template argument deduction/substitution failed: nkd.cpp:40:47: note: candidate expects 2 arguments, 1 provided if(rest(sol, R)%d)next_permutation(sol); ^ 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 nkd.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:3711:5: note: template<class _BIter, class _Compare> bool std::next_permutation(_BIter, _BIter, _Compare) next_permutation(_BidirectionalIterator __first, ^ /usr/include/c++/4.8/bits/stl_algo.h:3711:5: note: template argument deduction/substitution failed: nkd.cpp:40:47: note: candidate expects 3 arguments, 1 provided if(rest(sol, R)%d)next_permutation(sol); ^ nkd.cpp: In function 'int rest(char*, int)': nkd.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema nkd 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ă.