题解 | #BFS#

BFS

https://ac.nowcoder.com/acm/problem/17870

写个函数就行,这题属于是考查基本功了。

#include<stdio.h>

int ser(char s[101]){

int count=-1;

for(int i=1;i<100;i++){
    if((s[i]=='o'||s[i]=='O')&&(s[i-1]=='b'||s[i-1]=='B')&&(s[i+1]=='b'||s[i+1]=='B')){
        count=i-1;
        break;
    }
}
return count;

}

int main(){

char s[101];
scanf("%s",&s);
int len =ser(s);

printf("%d",len);

return 0;

}

全部评论
鬼了
点赞 回复 分享
发布于 10-16 21:53 江西

相关推荐

不愿透露姓名的神秘牛友
10-04 05:12
kalistar:简历留六个字,北京大学(本科),黑体加粗,看看哪个hr不长眼敢碰瓷我们北大✌
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务