1 solutions
-
0
#include #include
using namespace std;
//字符串 string s; int n; int ans;
int calc(string s){ int res = 0; for (int i=0;i<s.length();i++) if (s[i]=='V' && s[i+1] == 'K') res++; return res; }
int main(){ int n; cin >> n >> s; ans = calc(s); string t = s; for (int i=0;i<=s.length();i++){ s[i] = 'V'; ans = max(ans, calc(s)); s[i] = 'K'; ans = max(ans, calc(s)); s[i] = t[i]; }
cout << ans << endl;
}
- 1
Information
- ID
- 2705
- Time
- 400ms
- Memory
- 125MiB
- Difficulty
- 1
- Tags
- # Submissions
- 39
- Accepted
- 30
- Uploaded By