제출 #899546

#제출 시각아이디문제언어결과실행 시간메모리
899546duckindogKaučuk (COCI21_kaucuk)C++14
50 / 50
1 ms460 KiB
// from duckindog wth depression #include<bits/stdc++.h> using namespace std; int32_t main() { cin.tie(0)->sync_with_stdio(0); if (fopen("duck.inp", "r")) { freopen("duck.inp", "r", stdin); freopen("duck.out", "w", stdout); } int n; cin >> n; int one = 0, two, three; while (n--) { string s, t; cin >> s >> t; if (s == "section") { one += 1; two = 0, three = 0; cout << one << ' ' << t << '\n'; } if (s == "subsection") { two += 1; three = 0; cout << one << "." << two << " " << t << '\n'; } if (s == "subsubsection") { three += 1; cout << one << "." << two << "." << three << ' ' << t << '\n'; } } }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int32_t main()':
Main.cpp:10:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     freopen("duck.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:11:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     freopen("duck.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:28:13: warning: 'three' may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |       three += 1;
      |       ~~~~~~^~~~
Main.cpp:23:11: warning: 'two' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |       two += 1;
      |       ~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...