#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 | #64841785 | Utilizator | |
| Fișier | n.cpp | Dimensiune | 271 B |
| Data încărcării | 05 Iunie 2026, 18:46 | Scor/rezultat | Eroare de compilare |
n.cpp: In function ‘int main()’: n.cpp:9:8: warning: capture of variable ‘n’ with non-automatic storage duration 9 | x=[n/10000]; | ^ n.cpp:3:5: note: ‘int n’ declared here 3 | int n; | ^ n.cpp:9:9: error: expected ‘,’ before ‘/’ token 9 | x=[n/10000]; | ^ | , n.cpp:9:9: error: expected identifier before ‘/’ token n.cpp: In lambda function: n.cpp:9:16: error: expected ‘{’ before ‘;’ token 9 | x=[n/10000]; | ^ n.cpp: In function ‘int main()’: n.cpp:9:7: error: invalid user-defined conversion from ‘main()::<lambda()>’ to ‘int’ [-fpermissive] 9 | x=[n/10000]; | ^~~~~~~~~ n.cpp:9:7: note: candidate is: ‘main()::<lambda()>::operator void (*)()() const’ (near match) 9 | x=[n/10000]; | ^ n.cpp:9:7: note: no known conversion from ‘void (*)()’ to ‘int’ n.cpp:11:8: warning: capture of variable ‘n’ with non-automatic storage duration 11 | 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:11:9: error: expected ‘,’ before ‘/’ token 11 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ | , n.cpp:11:9: error: expected identifier before ‘/’ token n.cpp: In lambda function: n.cpp:11:15: error: expected ‘{’ before ‘%’ token 11 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ n.cpp: In function ‘int main()’: n.cpp:11:15: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 11 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ~~~~~~~~^~~ | | | | | int | main()::<lambda()> n.cpp:11:27: warning: capture of variable ‘n’ with non-automatic storage duration 11 | 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:11:28: error: expected ‘,’ before ‘/’ token 11 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ | , n.cpp:11:28: error: expected identifier before ‘/’ token n.cpp: In lambda function: n.cpp:11:33: error: expected ‘{’ before ‘%’ token 11 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ n.cpp: In function ‘int main()’: n.cpp:11:33: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 11 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ~~~~~~~^~~ | | | | | int | main()::<lambda()> n.cpp:11:42: warning: capture of variable ‘n’ with non-automatic storage duration 11 | 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:11:43: error: expected ‘,’ before ‘/’ token 11 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ | , n.cpp:11:43: error: expected identifier before ‘/’ token n.cpp: In lambda function: n.cpp:11:47: error: expected ‘{’ before ‘%’ token 11 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ^ n.cpp: In function ‘int main()’: n.cpp:11:47: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 11 | y=[n/1000]%10 * 1000+[n/100]%10*100+[n/10]%10+n%10; | ~~~~~~^~~ | | | | | int | main()::<lambda()> n.cpp:12:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 12 | 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ă.