제출 #715028

#제출 시각아이디문제언어결과실행 시간메모리
715028keystoneKamenčići (COCI21_kamencici)C++14
0 / 70
0 ms212 KiB
#include <iostream> #include <cstring> using namespace std; int main() { int n, k; cin >> n >> k; string pebbles; cin >> pebbles; int redCount = 0; for (char c : pebbles) { if (c == 'C') { redCount++; } } bool antunWins = true; if (redCount <= k) { antunWins = false; } else { int redRemoved = 0; int blueRemoved = 0; int i = 0; int j = n-1; while (i < j) { if (pebbles[i] == 'C') { redRemoved++; if (redRemoved == k) { antunWins = false; break; } } else { blueRemoved++; } i++; if (pebbles[j] == 'C') { redRemoved++; if (redRemoved == k) { antunWins = false; break; } } else { blueRemoved++; } j--; } if (i == j && pebbles[i] == 'C' && redRemoved < k) { antunWins = false; } } if (antunWins=(true)) { cout << "DA" << endl; } else { cout << "NE" << endl; } return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:56:18: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   56 |     if (antunWins=(true)) {
      |         ~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...