Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请高手帮我看一下WA的原因啊,多谢了思路就是基于两次xor还原的性质 #include<stdio.h> #include<string.h> char space[20100],nospace[20100]; int main() { int len,i; char key,clear; //freopen("in.txt","r",stdin); scanf("%s",nospace); scanf("%s",space); len=strlen(nospace); for(i=0;i<=len-1;i++) { if (nospace[i]>='0'&&nospace[i]<='9') nospace[i]-='0'; else nospace[i]=nospace[i]-('A'-10); } for(i=0;i<=len-1+2;i++) { if (space[i]>='0'&&space[i]<='9') space[i]-='0'; else space[i]=space[i]-('A'-10); } len/=2; for(i=0;i<=len-1;i++) nospace[i]=nospace[i*2]*16+nospace[i*2+1]; for(i=0;i<=len;i++) space[i]=space[i*2]*16+space[i*2+1]; clear=' '; for(i=0;i<=len-1;i++) { key=space[i]^clear; clear=nospace[i]^key; printf("%02X",key); } key=space[i]^clear; printf("%02X\n",key); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator