社区讨论
P3741 86pts求解
P3741小果的键盘参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mhjle640
- 此快照首次捕获于
- 2025/11/04 04:28 4 个月前
- 此快照最后确认于
- 2025/11/04 04:28 4 个月前
测试点#6,#13,#16,#17,#18,#39,#48 WA 了
有 dalao 能帮帮吗
CPP有 dalao 能帮帮吗
#include<bits/stdc++.h>
using namespace std;
int n,vk;
char s[102];
bool change=1;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin>>n>>s;
for(int i=0;i<n-1;i++)
if(s[i]=='V'&&s[i+1]=='K') vk++,i++;
else if(s[i]==s[i+1]&&change) vk++,change=0,i++;
else continue;
cout<<vk<<endl;
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...