题解 | #小乐乐与字符串#

小乐乐与字符串

http://www.nowcoder.com/practice/e09de1fc11db4a438cf8f0668848660d

#include<stdio.h> #include<string.h> int main() { char a[8000]={0}; int n,countC=0,countH=0,countN=0; long int count=0; scanf("%s",&a); n=strlen(a); for(int i=0;i<n;i++) { if(a[i]=='C') countC++; if(a[i]=='H') { countN=0; for(int y=i;y<n;y++) { if(a[y]=='N') countN++; } count=count+countN*countC; } } printf("%ld\n",count); return 0; }

全部评论

相关推荐

半解316:内容充实,细节需要修改一下。 1,整体压缩为一页。所有内容顶格。 2,项目描述删除,直接写个人工作量 修改完之后还需要建议,可以私聊
点赞 评论 收藏
分享
07-02 22:46
门头沟学院 Java
码农索隆:hr:“管你投没投,先挂了再说”
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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