Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## TLE

Posted by lookus at 2005-07-05 16:54:41 on Problem 2410
```难道不是模拟吗？
#include <iostream.h>
#include <string.h>
int m[33],pc,accu,c,x;
void in()
{
char str[10];
memset(m,0,sizeof(m));
for(int i=0;i<32;++i)
{
cin>>str;
for(int j=7;j>=0;--j)
m[i] = m[i]*2 + str[7-j]-'0';
}
accu = 0;
pc = 0;
}
void sol()
{
while(1){
if(pc>=32)
pc-=32;
c = m[pc++];
x = c&31;
switch(c>>5)
{
case 0:
m[x] = accu;
break;
case 1:
accu = m[x];
break;
case 2:
if(accu==0)
pc = x;
break;
case 3:
break;
case 4:
--accu;
if(accu < 0)
accu+=256;
break;
case 5:
++accu;
if(accu>=256)
accu-=256;
break;
case 6:
pc = x;
break;
case 7:
return ;
}
}
}
void out(int n)
{
char str[10];
memset(str,0,sizeof(str));
for(int i=0;i<8;++i)
if(n&(1<<i))
str[7-i] = '1';
else
str[7-i] = '0';
cout<<str<<endl;
}
void main()
{
while(cin)
{
in();
sol();
out(accu);
}
}```

Followed by: