zoj 3179 - Calculate With Abacus

/*
直接模拟就行了 
*/
#define LOCAL
#include<iostream>
#include<string>
using namespace std;
int main()
{
#ifdef LOCAL
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
#endif
    
    
    string a,up,down[5];
    int i,j,m,num,sum,t;
    cin>>m;
    while(m--)
    {
            cin>>i>>j;
            num=0;
            for(;i<=j;i++)
               num+=i;
            cin>>a>>up>>a;
            for(i=0;i<5;i++)
                 cin>>down[i];  
            sum=0;
            t=1;
            for(i=5;i>=0;i--)
            {
                   if(up[i]=='o')
                        sum+=t*5;
                   t*=10;                 
            }        
            t=1;
            for(i=5;i>=0;i--)
            {
                 j=0;
                 while(down[j][i]!='|') j++;
                 sum+=j*t;
                 t*=10;                 
            }
            if(sum==num)
               cout<<"No mistake"<<endl;
            else
               cout<<"Mistake"<<endl;
            cin.get();
    }
    return 0;
}

你可能感兴趣的:(zoj 3179 - Calculate With Abacus)