北大OJ1013
来源:互联网 发布:阿里云数据库外网 编辑:程序博客网 时间:2024/05/29 07:11
#include<iostream>#include<cstring>using namespace std;char Left[3][7],Right[3][7],Result[3][7];bool isLight(char c){ for(int i=0;i<3;i++) { if(strcmp(Result[i],"even")==0) { if(strchr(Left[i],c)!=NULL||strchr(Right[i],c)!=NULL) return false; } if(strcmp(Result[i],"up")==0) { if(strchr(Right[i],c)==NULL)return false; } if(strcmp(Result[i],"down")==0) { if(strchr(Left[i],c)==NULL)return false; } } return true;}bool isHeavy(char c){ for(int i=0;i<3;i++) { if(strcmp(Result[i],"even")==0) { if(strchr(Left[i],c)!=NULL||strchr(Right[i],c)!=NULL) return false; } if(strcmp(Result[i],"up")==0) { if(strchr(Left[i],c)==NULL)return false; } if(strcmp(Result[i],"down")==0) { if(strchr(Right[i],c)==NULL)return false; } } return true;}int main(){ int n;cin>>n;while(n--){for(int i=0;i<3;i++)cin>>Left[i]>>Right[i]>>Result[i]; for (char c = 'A'; c <= 'L'; c++ ){ if ( isLight(c) ){ cout<<c<<" is the counterfeit coin and it is light.\n"; break; } if ( isHeavy(c) ) { cout<<c<<" is the counterfeit coin and it is heavy.\n"; break; }}}return 0;}
0 0
- 北大OJ1013
- 九度oj1013
- 杭电oj1013
- 杭电oj1013
- OJ1013 开门人和关门人
- 【题解】-航电OJ1013 Digital Roots
- 水题也可以由不同的水法~!@#$%PKU OJ1013
- 北大简介
- 北大青鸟
- 北大青鸟
- 北大青鸟
- 北大acm1005
- 北大acm1008
- 北大1547
- 北大1120
- 北大1019
- 北大1006
- 北大1590
- shell 脚本中将输出内容赋值给一个变量时的换行问题
- 七牛---关于Python SDK的各种Demo
- 北大OJ1012
- uva1121 Subsequence 【二分】
- runLoop和runtime的分析
- 北大OJ1013
- 1011.A+B和C
- [Android]Activity生命周期
- [c++ 温故知新] 函数引用入参的作用
- Linux根目录详解
- 使用最新springframework 4.2.3.RELEASE + Maven 3.3.9 + eclipse(Mars.1 Release (4.5.1)) 搭建IM平台(一)
- Win7 Vim 中文文档
- JavaEE_Mybatis_SpringMVC_整合开发_Controller的返回值
- 如何判断用户输入的邮箱格式是否正确?