Counterfeit Dollar

2015-07-20 17:07:07 ? 作者: ? 浏览: 4

?

题意 :
有12个硬币 有一个是假的 比其他的或轻或重 分别标记为A到L
然后输入cas 有个cas组数据
每组输入3行 每行3个字符串 第一个表示当时天平上左边有哪几个字符 第二个是右边 2边个数一样 但是不一定有几个

之后第三个字符串描述左边是比右边大小还是相等
问你 哪一个硬币是假的 假的相对于真的是清还是重 (假硬币有轻有重,只有一枚是假硬币)
保证有解

?

up:右轻 
 
 
down:右重 
even:一样重

?

#include
  
   
#include
   
     #include
    
      using namespace std; int v[15],cot[15]; int fun(int x) { if(x<0) return -x; return x; } int main() { int i,j,t; char a[15],b[15],c[5]; scanf(%d,&t); while(t--) { memset(v,0,sizeof(v)); memset(cot,0,sizeof(cot)); for(i=0;i<3;i++) { scanf(%s%s%s,a,b,c); if(strcmp(c,up)==0) {//右轻 for(j=0;j
     
      0) printf(%c is the counterfeit coin and it is heavy. ,ans+'A'); else printf(%c is the counterfeit coin and it is light. ,ans+'A'); } return 0; } 
     
    
   
  


?

-->

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: