poj 1013
来源:互联网 发布:oracle数据库最高权限 编辑:程序博客网 时间:2024/05/18 01:21
这道题有这么难就只有一种方法排除。。。
我开始想了好久
都 WA 了 最后终于AC了。。。。
#include <iostream>#include <cmath>#include <string>using namespace std;bool even[20];int time[20];string k1,k2,k3;int main(){int t,i,j,max;cin>>t;while(t--){memset(even,0,sizeof(even));memset(time,0,sizeof(time));for(j=0;j<3;j++){cin>>k1>>k2>>k3;if (k3=="even"){for(i=0;i<k1.length();i++)even[k1[i]-'A']=true;for(i=0;i<k2.length();i++)even[k2[i]-'A']=true;}if (k3=="up"){for(i=0;i<k1.length();i++)time[k1[i]-'A']++;for(i=0;i<k2.length();i++)time[k2[i]-'A']--;}if (k3=="down"){for(i=0;i<k1.length();i++)time[k1[i]-'A']--;for(i=0;i<k2.length();i++)time[k2[i]-'A']++;}}max=-1;for(i=0;i<20;i++){if (even[i])continue;if (max<=abs(time[i])){max=abs(time[i]);j=i;}}cout<<char(j+'A');if (time[j]>0)cout<<" is the counterfeit coin and it is heavy."<<endl; else cout<<" is the counterfeit coin and it is light."<<endl;}return 0;}
我hdu 的号叫做阿迪达斯
poj 叫1759432774a
QQ号是1759432774 愿意加我,我们讨论
有兴趣可以看看我
0 0
- POJ 1013
- Poj 1013
- poj 1013
- POJ 1013
- POJ-1013
- POJ 1013
- poj 1013
- poj 1013
- poj-1013
- poj 1013
- poj 1013 && poj 1029【寻找硬币】
- POJ 1013 Counterfeit Dollar
- POJ 1013 Counterfeit Dollar
- hdoj 1482 poj 1013
- POJ 1013 Counterfeit Dollar
- POJ 1013 Counterfeit Dollar
- POJ 1013 Counterfeit Dollar
- POJ 1013 称硬币
- Page Master
- 从屏幕读取字符串,并提取其中数字串,再次打印到屏幕或写入一个文件
- 习题4-8 特别困的学生 UVa12108
- 栈
- 子数组之和的最大值(二维)
- poj 1013
- LDO
- java.lang.NoSuchMethodException: xu.action.product.ProductAction.list()
- POJ 1731 Orders(全排列)
- findViewById中NullPointerException的错误
- 北大oj--3980
- 基变换和图像压缩
- Debian那些事
- 析构函数为什么一般是虚函数