#4718
Cu cifrele de la 1 la 9 construim un triunghi astfel:
1
2 3
4 5 6
7 8 9 1
2 3 4 5 6
7 8 9 1 2 3
.................
Dându-se L şi C două numere naturale, să se determine a C-a cifră care se află pe linia L din acest triunghi, considerând că liniile se numerotează de la 1.
Concurs de selecție clasa a 9-a Centru de Excelență în Informatică 2024 - Vaslui
| Problema | TriunghiCif | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 4 MB
/
Stivă 2 MB
|
| Id soluție | #64682245 | Utilizator | |
| Fișier | triunghicif.cpp | Dimensiune | 1.04 KB |
| Data încărcării | 22 Mai 2026, 13:57 | Scor/rezultat | Eroare de compilare |
triunghicif.cpp: In function ‘int main()’: triunghicif.cpp:9:10: error: expected ‘,’ before ‘*’ token 9 | if([L*(L-1)/2+C]%9==0) | ^ | , triunghicif.cpp:9:10: error: expected identifier before ‘*’ token triunghicif.cpp: In lambda function: triunghicif.cpp:9:21: error: expected ‘{’ before ‘%’ token 9 | if([L*(L-1)/2+C]%9==0) | ^ triunghicif.cpp: In function ‘int main()’: triunghicif.cpp:9:21: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 9 | if([L*(L-1)/2+C]%9==0) | ~~~~~~~~~~~~~^~ | | | | | int | main()::<lambda()> triunghicif.cpp:15:14: error: expected ‘,’ before ‘*’ token 15 | if([L*(L-1)/2+C]%9==8) | ^ | , triunghicif.cpp:15:14: error: expected identifier before ‘*’ token triunghicif.cpp: In lambda function: triunghicif.cpp:15:25: error: expected ‘{’ before ‘%’ token 15 | if([L*(L-1)/2+C]%9==8) | ^ triunghicif.cpp: In function ‘int main()’: triunghicif.cpp:15:25: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 15 | if([L*(L-1)/2+C]%9==8) | ~~~~~~~~~~~~~^~ | | | | | int | main()::<lambda()> triunghicif.cpp:20:5: error: ‘else’ without a previous ‘if’ 20 | else | ^~~~ triunghicif.cpp:22:14: error: expected ‘,’ before ‘*’ token 22 | if([L*(L-1)/2+C]%9==7) | ^ | , triunghicif.cpp:22:14: error: expected identifier before ‘*’ token triunghicif.cpp: In lambda function: triunghicif.cpp:22:25: error: expected ‘{’ before ‘%’ token 22 | if([L*(L-1)/2+C]%9==7) | ^ triunghicif.cpp: In function ‘int main()’: triunghicif.cpp:22:25: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 22 | if([L*(L-1)/2+C]%9==7) | ~~~~~~~~~~~~~^~ | | | | | int | main()::<lambda()> triunghicif.cpp:27:5: error: ‘else’ without a previous ‘if’ 27 | else | ^~~~ triunghicif.cpp:29:14: error: expected ‘,’ before ‘*’ token 29 | if([L*(L-1)/2+C]%9==6) | ^ | , triunghicif.cpp:29:14: error: expected identifier before ‘*’ token triunghicif.cpp: In lambda function: triunghicif.cpp:29:25: error: expected ‘{’ before ‘%’ token 29 | if([L*(L-1)/2+C]%9==6) | ^ triunghicif.cpp: In function ‘int main()’: triunghicif.cpp:29:25: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 29 | if([L*(L-1)/2+C]%9==6) | ~~~~~~~~~~~~~^~ | | | | | int | main()::<lambda()> triunghicif.cpp:34:5: error: ‘else’ without a previous ‘if’ 34 | else | ^~~~ triunghicif.cpp:36:14: error: expected ‘,’ before ‘*’ token 36 | if([L*(L-1)/2+C]%9==5) | ^ | , triunghicif.cpp:36:14: error: expected identifier before ‘*’ token triunghicif.cpp: In lambda function: triunghicif.cpp:36:25: error: expected ‘{’ before ‘%’ token 36 | if([L*(L-1)/2+C]%9==5) | ^ triunghicif.cpp: In function ‘int main()’: triunghicif.cpp:36:25: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 36 | if([L*(L-1)/2+C]%9==5) | ~~~~~~~~~~~~~^~ | | | | | int | main()::<lambda()> triunghicif.cpp:41:5: error: ‘else’ without a previous ‘if’ 41 | else | ^~~~ triunghicif.cpp:43:14: error: expected ‘,’ before ‘*’ token 43 | if([L*(L-1)/2+C]%9==4) | ^ | , triunghicif.cpp:43:14: error: expected identifier before ‘*’ token triunghicif.cpp: In lambda function: triunghicif.cpp:43:25: error: expected ‘{’ before ‘%’ token 43 | if([L*(L-1)/2+C]%9==4) | ^ triunghicif.cpp: In function ‘int main()’: triunghicif.cpp:43:25: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 43 | if([L*(L-1)/2+C]%9==4) | ~~~~~~~~~~~~~^~ | | | | | int | main()::<lambda()> triunghicif.cpp:48:5: error: ‘else’ without a previous ‘if’ 48 | else | ^~~~ triunghicif.cpp:50:14: error: expected ‘,’ before ‘*’ token 50 | if([L*(L-1)/2+C]%9==3) | ^ | , triunghicif.cpp:50:14: error: expected identifier before ‘*’ token triunghicif.cpp: In lambda function: triunghicif.cpp:50:25: error: expected ‘{’ before ‘%’ token 50 | if([L*(L-1)/2+C]%9==3) | ^ triunghicif.cpp: In function ‘int main()’: triunghicif.cpp:50:25: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 50 | if([L*(L-1)/2+C]%9==3) | ~~~~~~~~~~~~~^~ | | | | | int | main()::<lambda()> triunghicif.cpp:55:5: error: ‘else’ without a previous ‘if’ 55 | else | ^~~~ triunghicif.cpp:57:14: error: expected ‘,’ before ‘*’ token 57 | if([L*(L-1)/2+C]%9==2) | ^ | , triunghicif.cpp:57:14: error: expected identifier before ‘*’ token triunghicif.cpp: In lambda function: triunghicif.cpp:57:25: error: expected ‘{’ before ‘%’ token 57 | if([L*(L-1)/2+C]%9==2) | ^ triunghicif.cpp: In function ‘int main()’: triunghicif.cpp:57:25: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 57 | if([L*(L-1)/2+C]%9==2) | ~~~~~~~~~~~~~^~ | | | | | int | main()::<lambda()> triunghicif.cpp:62:5: error: ‘else’ without a previous ‘if’ 62 | else | ^~~~ triunghicif.cpp:64:14: error: expected ‘,’ before ‘*’ token 64 | if([L*(L-1)/2+C]%9==1) | ^ | , triunghicif.cpp:64:14: error: expected identifier before ‘*’ token triunghicif.cpp: In lambda function: triunghicif.cpp:64:25: error: expected ‘{’ before ‘%’ token 64 | if([L*(L-1)/2+C]%9==1) | ^ triunghicif.cpp: In function ‘int main()’: triunghicif.cpp:64:25: error: no match for ‘operator%’ (operand types are ‘main()::<lambda()>’ and ‘int’) 64 | if([L*(L-1)/2+C]%9==1) | ~~~~~~~~~~~~~^~ | | | | | int | main()::<lambda()>
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema TriunghiCif 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ă.