#1297
Se dă un triunghi de numere. Deduceți regula după care a fost format si afișați al n-lea sir al acestui triunghi.
| Problema | triunghiul | Operații I/O |
triunghiul.in/triunghiul.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64963539 | Utilizator | |
| Fișier | triunghiul.cpp | Dimensiune | 1006 B |
| Data încărcării | 26 Iunie 2026, 12:21 | Scor/rezultat | Eroare de compilare |
triunghiul.cpp:12:19: error: stray ‘#’ in program 12 | for (int j#include <iostream> | ^ triunghiul.cpp: In function ‘void pasc(int, int)’: triunghiul.cpp:12:19: error: expected ‘;’ before ‘include’ 12 | for (int j#include <iostream> | ^~~~~~~~ | ; triunghiul.cpp:12:20: error: ‘include’ was not declared in this scope 12 | for (int j#include <iostream> | ^~~~~~~ triunghiul.cpp:12:37: error: expected primary-expression before ‘>’ token 12 | for (int j#include <iostream> | ^ In file included from /usr/include/c++/13/fstream:42, from triunghiul.cpp:13: /usr/include/c++/13/bits/codecvt.h:44:1: error: expected primary-expression before ‘namespace’ 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~ triunghiul.cpp:12:38: error: expected ‘;’ before ‘namespace’ 12 | for (int j#include <iostream> | ^ | ; /usr/include/c++/13/bits/codecvt.h:44:1: error: expected primary-expression before ‘namespace’ 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~ triunghiul.cpp:12:38: error: expected ‘)’ before ‘namespace’ 12 | for (int j#include <iostream> | ~ ^ | ) In file included from /usr/include/c++/13/bits/requires_hosted.h:31, from /usr/include/c++/13/iostream:38, from triunghiul.cpp:1: /usr/include/c++/13/bits/codecvt.h:44:15: error: expected ‘=’ before ‘__attribute__’ 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/codecvt.h:44:15: error: expected identifier before ‘__attribute__’ /usr/include/c++/13/bits/codecvt.h:44:14: error: expected ‘;’ before ‘__attribute__’ 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; triunghiul.cpp:12:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 12 | for (int j#include <iostream> | ^~~ /usr/include/c++/13/bits/codecvt.h:44:15: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ triunghiul.cpp:12:18: warning: unused variable ‘j’ [-Wunused-variable] 12 | for (int j#include <iostream> | ^ /usr/include/c++/13/bits/codecvt.h:45:1: error: expected primary-expression before ‘{’ token 45 | { | ^ /usr/include/x86_64-linux-gnu/c++/13/bits/c++io.h:38:15: error: expected ‘=’ before ‘__attribute__’ 38 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/x86_64-linux-gnu/c++/13/bits/c++io.h:38:15: error: expected identifier before ‘__attribute__’ In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/basic_file.h:40, from /usr/include/c++/13/fstream:44: /usr/include/x86_64-linux-gnu/c++/13/bits/c++io.h:38:14: error: expected ‘;’ before ‘__attribute__’ 38 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/x86_64-linux-gnu/c++/13/bits/c++io.h:39:1: error: expected primary-expression before ‘{’ token 39 | { | ^ /usr/include/x86_64-linux-gnu/c++/13/bits/basic_file.h:44:15: error: expected ‘=’ before ‘__attribute__’ 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/x86_64-linux-gnu/c++/13/bits/basic_file.h:44:15: error: expected identifier before ‘__attribute__’ /usr/include/x86_64-linux-gnu/c++/13/bits/basic_file.h:44:14: error: expected ‘;’ before ‘__attribute__’ 44 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/x86_64-linux-gnu/c++/13/bits/basic_file.h:45:1: error: expected primary-expression before ‘{’ token 45 | { | ^ /usr/include/c++/13/fstream:54:15: error: expected ‘=’ before ‘__attribute__’ 54 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/fstream:54:15: error: expected identifier before ‘__attribute__’ /usr/include/c++/13/fstream:54:14: error: expected ‘;’ before ‘__attribute__’ 54 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/13/fstream:55:1: error: expected primary-expression before ‘{’ token 55 | { | ^ /usr/include/c++/13/bits/fstream.tcc:43:15: error: expected ‘=’ before ‘__attribute__’ 43 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/fstream.tcc:43:15: error: expected identifier before ‘__attribute__’ In file included from /usr/include/c++/13/fstream:1300: /usr/include/c++/13/bits/fstream.tcc:43:14: error: expected ‘;’ before ‘__attribute__’ 43 | namespace std _GLIBCXX_VISIBILITY(default) | ^ | ; /usr/include/c++/13/bits/fstream.tcc:44:1: error: expected primary-expression before ‘{’ token 44 | { | ^ triunghiul.cpp:15:14: error: variable ‘std::ifstream fin’ has initializer but incomplete type 15 | ifstream fin ("triunghiul.in"); | ^ triunghiul.cpp:16:15: error: variable ‘std::ofstream fout’ has initializer but incomplete type 16 | ofstream fout ("triunghiul.out"); | ^ triunghiul.cpp:18:26: error: a function-definition is not allowed here before ‘{’ token 18 | void pasc (int i, int n) { | ^ triunghiul.cpp:31:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 31 | int main() | ^~ triunghiul.cpp:31:9: note: remove parentheses to default-initialize a variable 31 | int main() | ^~ | -- triunghiul.cpp:31:9: note: or replace parentheses with braces to value-initialize a variable triunghiul.cpp:32:1: error: a function-definition is not allowed here before ‘{’ token 32 | { | ^ triunghiul.cpp:40:1: error: expected primary-expression before ‘=’ token 40 | =2; j<=(n-i); j++) p /= j; | ^ triunghiul.cpp:40:5: error: ‘j’ was not declared in this scope 40 | =2; j<=(n-i); j++) p /= j; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema triunghiul 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ă.