4917: Hash Killer IV
来源:互联网 发布:咖啡杯图片大全淘宝 编辑:程序博客网 时间:2024/05/22 02:28
今天晚上本来是做作业的。。。但是手痒又来敲了一题。。。作业当然就没做了。。。早知道晚上想打题还不如打CF。。然后就开始看这题了,一眼——智障模拟题嘛。。于是开始码码码。。。肯快就码玩了。。还手动除了几个样例,感觉很对啊,于是就叫了。。WA。。。WA。。。。还是WA。。。。。QAQ这评测机子有毒吧。。。当时我用的是这份代码(变态的我已经全部加了LL)
#include<cstdio>#include<cstring>typedef long long LL;const LL N=200;LL Q;LL a[N],cnt;//二进制LL mymax (LL x,LL y){ return x>y?x:y;}void change (LL x)//先将这个变为二进制 { cnt=0; while (x>0LL) { a[++cnt]=(x&1LL); x>>=1LL; } return ;}void change1 (LL ooo){ for (LL u=mymax(0LL,cnt-ooo);u>=1LL;u--) a[u]=a[u]^a[u+ooo];}LL bt (){ LL x=0; for (LL u=1;u<=cnt;u++) x=x+a[u]*(1LL<<(u-1LL)); return x;}int main(){ /* printf("%d\n",1<<28); freopen("a.in","r",stdin);*/ scanf("%lld",&Q); while (Q--) { LL t; scanf("%lld",&t); t=t/((1LL<<16LL)+1LL); change(t); change1(11LL); t=bt(); t=t/((1LL<<3LL)+1LL); change(t); change1(6LL); t=bt(); t=t/((1LL<<10LL)+1LL); printf("%lld\n",t); } return 0;}
拿去对拍,数据出大了。。发现不一样天真的我以为数据太大帮标称开了long long
然后排啊排,全对啊,感觉很棒棒。。
还是WA,严重怀疑评测机。。于
是去找了TYB大佬。。跪烂。。他和我说可能不能开long long,因为题目是unsigned int
蛤,还有这种操作,于是就发现自己已经错得一塌糊涂了QAQ最后看了下标称,思路都是一样的都是倒着模拟。
hash不注重定义类似害死人。。。。最后懒得写用了标称精神AC【捂脸】
#include<cmath>#include<cstdio> #include<cstdlib>#include<cstring> #include<iostream>#include<algorithm>using namespace std;unsigned int q,t,bin[35];int main(){ scanf("%u",&q); bin[0]=1; for (int i=1;i<=31;i++) bin[i]=bin[i-1]*2; while (q--){ scanf("%u",&t); for (int i=0;i<=15;i++) t-=((t/bin[i])&1)*bin[i+16]; for (int i=31;i>=11;i--) t^=((t/bin[i])&1)*bin[i-11]; for (int i=0;i<=28;i++) t-=((t/bin[i])&1)*bin[i+3]; for (int i=31;i>=6;i--) t^=((t/bin[i])&1)*bin[i-6]; for (int i=0;i<=21;i++) t-=((t/bin[i])&1)*bin[i+10]; printf("%u\n",t); }}
这题告诉我,1.一定要看清楚题 2.hash一定要注意类型
阅读全文
1 0
- 4917: Hash Killer IV
- 4917: Hash Killer IV
- bzoj 4917: Hash Killer IV 模拟
- bzoj4917: Hash Killer IV
- BZOJ4917 Hash Killer IV
- bzoj4917: Hash Killer IV
- [BZOJ4917][Lydsy六月份月赛 .A][模拟]Hash Killer IV
- bzoj4917 [Lydsy六月月赛]Hash Killer IV
- 【BZOJ3098】Hash Killer Ⅱ
- BZOJ3098: Hash Killer II
- 3097: Hash Killer I
- bzoj 3098 hash killer
- 3098: Hash Killer II
- 3097: Hash Killer I
- bzoj3097 Hash Killer I
- bzoj3098 Hash Killer II
- 【BZOJ 3097】 Hash Killer I
- bzoj 3098: Hash Killer II
- 连表查询之 rowid和rownum笔记
- ORACLE多租户
- windows——基本数据类型
- 界面为ScrollView时打开界面会自动滚动到底部之解决方法
- mysql分区
- 4917: Hash Killer IV
- RCNN学习笔记(5):faster rcnn
- java一些开发注意事项
- webService
- Fragment中 onActivityResult回调
- Houdini 名词
- nodejs安装及国内源设置
- Android pm 命令详解
- Spring的PropertyPlaceholderConfigurer应用