3-1
#include<stdio.h>
#include<string.h>
int main() {
char s[]={"OOXXOXXOOO"};
int tot = 0,num=0;
int a=strlen(s);
for(int i = 0; i < a ; i++)
{if(s[i]=='O') {num++;
}else num=0;
tot+=num;
}
printf("%d\n", tot);
}
3-2
3-1
#include<stdio.h>
#include<string.h>
int main() {
char s[]={"OOXXOXXOOO"};
int tot = 0,num=0;
int a=strlen(s);
for(int i = 0; i < a ; i++)
{if(s[i]=='O') {num++;
}else num=0;
tot+=num;
}
printf("%d\n", tot);
}
3-2
674

被折叠的 条评论
为什么被折叠?