正文
增加 10 行删除 10 行
26 行未改动27282930313233343536373839404142434445464748495031 行未改动82838485868788899091929394959697989910010110210310410510610710826 行未改动using std::vector;using std::deque;int main() {vector<deque<char>> q{{'A', 'E'}, {'B'}, {'C'}, {'D'}};int k;cin >> k;rep(i, k) {char c = q[i%4].front();q[i%4].pop_front();q[(i+1)%4].push_back(c);}rep(i, 4) {for (char c : q[i]) cout << c;cout << '\n';}return 0;}```31 行未改动int main() {int n;cin >> n;vector<int> a(n);rep(i, n) cin >> a[i];vector<int> dp(n);for (int i = n-2; i >= 0; --i) {if (a[i] == 0) dp[i] = 0;else if (a[i+1] == 1) dp[i] = 1;else {if (i == n-2) dp[i] = 1;else dp[i] = dp[i+2] + 2;}}ll ans = 0;rep(i, n) ans += dp[i];cout << ans << '\n';return 0;}```26 行未改动27282930313233343536373839404142434445464748495031 行未改动82838485868788899091929394959697989910010110210310410510610710826 行未改动using std::vector;using std::deque;int main() {vector<deque<char>> q{{'A', 'E'}, {'B'}, {'C'}, {'D'}};int k;cin >> k;rep(i, k) {char c = q[i%4].front();q[i%4].pop_front();q[(i+1)%4].push_back(c);}rep(i, 4) {for (char c : q[i]) cout << c;cout << '\n';}return 0;}```31 行未改动int main() {int n;cin >> n;vector<int> a(n);rep(i, n) cin >> a[i];vector<int> dp(n);for (int i = n-2; i >= 0; --i) {if (a[i] == 0) dp[i] = 0;else if (a[i+1] == 1) dp[i] = 1;else {if (i == n-2) dp[i] = 1;else dp[i] = dp[i+2] + 2;}}ll ans = 0;rep(i, n) ans += dp[i];cout << ans << '\n';return 0;}```