1003. 我要通过!(20)
来源:互联网 发布:vb if语句前 编辑:程序博客网 时间:2024/04/28 19:15
主要理解的难点是在第3个条件
假设左边A的数量为a,中间的为b,右边的为c,满足a*b=c这个条件的为正确的
#include<stdio.h>#include<string.h>int main(){ int n; scanf("%d",&n); char word[n][110]; int i; for(i=0;i<n;i++) { scanf("%s",word[i]); } for(i=0;i<n;i++) { if(strchr(word[i],'P')==NULL||strchr(word[i],'A')==NULL||strchr(word[i],'T')==NULL) { printf("NO\n");// printf("%s",word[i]); } else { int j=0; int cnt1=0,cnt2=0,cnt3=0,cnt4=0; while(word[i][j]!='\0') { if(word[i][j]=='P'||word[i][j]=='A'||word[i][j]=='T') { cnt4++; } j++; } if(strlen(word[i])>cnt4) { printf("NO\n"); } else { j=0; while(word[i][j]!='P') { cnt1++; j++; } ++j; while(word[i][j]!='T') { cnt2++; j++; } ++j; while(word[i][j]!='\0') { cnt3++; j++; } if(cnt1*cnt2==cnt3) { printf("YES\n"); }else { printf("NO\n"); } } } }}
0 0
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- 1003. 我要通过!(20)
- MySQL常用工具之percona-toolkit
- java处理json数据
- 转_Fragment全解析
- 使用trigger解耦
- 数字图像滤波
- 1003. 我要通过!(20)
- Github在线安装老网络失败解决方案
- telnet client 安装使用
- IOS实现SpotLight搜索 让你的APP支持SpotLight搜索
- 数字图像边缘检测算子
- scikit-learn学习笔记:非线性核单类的SVM(One-class SVM with non-linear kernel (RBF))
- js实现a标签超链接提交form表单的方法
- 堆及其操作
- 单步调试 step into/step out/step over 区别