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 |
为什么一直在 time limited#include<iostream> #include<string> #include<cmath> #include<algorithm> using namespace std; char mem[256]; char ss[17]="0123456789ABCDEF"; int main( ) { char a, b,ch; int i,num; bool flag; while ( true ){ for ( i=0; i<256; i++ ) if(scanf("%c",&mem[i])==EOF) return 0; scanf("%c",&ch); for ( i=0; i<256; i++ ) { mem[i] -= 48; if(mem[i] > 9) mem[i] -= 7; } if( mem[0] == 8 ) break; num = 0; flag = true; while ( flag ){ switch ( mem[num++] ){ case 0: a = mem[( mem[num] << 4 ) + mem[num+1]]; num+=2; break; case 1: mem[( mem[num] << 4 ) + mem[num+1]] = (a &= 15); num+=2; break; case 2: swap(a,b); break; case 3: a+=b; b=a>>4; break; case 4: a++; break; case 5: a--; break; case 6: if((a&=15)!=0) { num+=2; break; } break; case 7: num=((mem[num]<<4)+mem[num+1]); break; case 8: flag = false; } } for(i=0;i<256;i++) printf("%c",ss[mem[i]]); printf("\n"); } system("pause"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator