#4862
Se citește de la tastatură un număr natural n de 8 cifre. Să se verifice dacă numărul format din primele 4 cifre ale lui n este egal cu numărul format din ultimele 4 cifre ale lui n.
| Problema | 2n | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64841776 | Utilizator | |
| Fișier | n.cpp | Dimensiune | 257 B |
| Data încărcării | 05 Iunie 2026, 18:44 | Scor/rezultat | Eroare de compilare |
n.cpp: In function ‘int main()’: n.cpp:8:8: warning: capture of variable ‘n’ with non-automatic storage duration 8 | x=[n/10000]; | ^ n.cpp:3:5: note: ‘int n’ declared here 3 | int n; | ^ n.cpp:8:9: error: expected ‘,’ before ‘/’ token 8 | x=[n/10000]; | ^ | , n.cpp:8:9: error: expected identifier before ‘/’ token n.cpp: In lambda function: n.cpp:8:16: error: expected ‘{’ before ‘;’ token 8 | x=[n/10000]; | ^ n.cpp: In function ‘int main()’: n.cpp:8:7: error: invalid user-defined conversion from ‘main()::<lambda()>’ to ‘int’ [-fpermissive] 8 | x=[n/10000]; | ^~~~~~~~~ n.cpp:8:7: note: candidate is: ‘main()::<lambda()>::operator void (*)()() const’ (near match) 8 | x=[n/10000]; | ^ n.cpp:8:7: note: no known conversion from ‘void (*)()’ to ‘int’ n.cpp:10:8: warning: capture of variable ‘n’ with non-automatic storage duration 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ n.cpp:3:5: note: ‘int n’ declared here 3 | int n; | ^ n.cpp:10:9: error: expected ‘,’ before ‘/’ token 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ | , n.cpp:10:9: error: expected identifier before ‘/’ token n.cpp: In lambda function: n.cpp:10:15: error: expected ‘{’ before ‘%’ token 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ n.cpp: In function ‘int main()’: n.cpp:10:15: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ~~~~~~~~^~~ | | | | | int | main()::<lambda()> n.cpp:10:27: warning: capture of variable ‘n’ with non-automatic storage duration 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ n.cpp:3:5: note: ‘int n’ declared here 3 | int n; | ^ n.cpp:10:28: error: expected ‘,’ before ‘/’ token 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ | , n.cpp:10:28: error: expected identifier before ‘/’ token n.cpp: In lambda function: n.cpp:10:33: error: expected ‘{’ before ‘%’ token 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ n.cpp: In function ‘int main()’: n.cpp:10:33: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ~~~~~~~^~~ | | | | | int | main()::<lambda()> n.cpp:10:42: warning: capture of variable ‘n’ with non-automatic storage duration 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ n.cpp:3:5: note: ‘int n’ declared here 3 | int n; | ^ n.cpp:10:43: error: expected ‘,’ before ‘/’ token 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ | , n.cpp:10:43: error: expected identifier before ‘/’ token n.cpp: In lambda function: n.cpp:10:47: error: expected ‘{’ before ‘%’ token 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ n.cpp: In function ‘int main()’: n.cpp:10:47: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 10 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ~~~~~~^~~ | | | | | int | main()::<lambda()> n.cpp:11:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 11 | if(x=y) | ~^~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema 2n 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ă.