/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 1ms 536.0 KiB
#3 Wrong Answer 2ms 320.0 KiB

Code

#include <bits/stdc++.h>
#define int long long
#define sqrt(x) sqrtl(x)
using namespace std;

namespace solve {
  namespace test_case {
    void main() {
      int n, k, ans (0);
      string s; cin >> n >> k >> s;
      for (int i (0); i <= n - 3; i++) {
        int move (0);
        move += (26 + 'a' - s[i]) % 26;
        move += (26 + 'b' - s[i + 1]) % 26;
        move += (26 + 'c' - s[i + 2]) % 26;
        ans += (move <= k);
      }
      cout << ans << '\n';
    }
  }

  void main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t (1); cin >> t; 
    while (t--) {
      test_case::main();
    }
  }
}

signed main() { solve::main(); } 

Information

Submit By
Type
Submission
Problem
P1100 Substring ABC
Contest
Brain Booster #6
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-03 17:10:38
Judged At
2024-12-17 11:33:14
Judged By
Score
2
Total Time
2ms
Peak Memory
536.0 KiB