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

不用检查也能AC...神了...如此程序只作反例....呵呵...

Posted by ice_lemon at 2006-08-12 00:15:36 on Problem 2261
#include <cstdlib>
#include <iostream>
double semi[20];
double de[20];
double final[20];
using namespace std;
char c[20][20];
int b[20][20];
double a[20][20];
int main()
{   int i,j,t;
    double sum=0.0;
   
    memset(a,0,sizeof(a));
    for(i=1;i<=16;i++)
     scanf("%s",&c[i]);
     
     for(i=1;i<=16;i++)
       for(j=1;j<=16;j++)
        scanf("%d",&b[i][j]);
        
      for(i=1;i<=16;i++)
       for(j=1;j<=16;j++)
       a[i][j]=b[i][j]*0.01;  
       
       for(i=1;i<=16;i++)
       {
         if(i%4==1) 
         { semi[i]=a[i][i+1]*(a[i+2][i+3]*a[i][i+2]+a[i+3][i+2]*a[i][i+3]);
          
         }
          
          if(i%4==2) 
          {
            semi[i]=a[i][i-1]*(a[i+1][i+2]*a[i][i+1]+a[i+2][i+1]*a[i][i+2]);
          }
          if(i%4==3)
          {
            semi[i]=a[i][i+1]*(a[i-2][i-1]*a[i][i-2]+a[i-1][i-2]*a[i][i-1]);
          }
          if(i%4==0)
          {
          semi[i]=a[i][i-1]*(a[i-3][i-2]*a[i][i-3]+a[i-2][i-3]*a[i][i-2]);
          }
         
       }
       
        for(i=1;i<=16;i++)
        {  
            if(i%8==1)              
            de[i]=semi[i]*(semi[i+4]*a[i][i+4]+semi[i+5]*a[i][i+5]+semi[i+6]*a[i][i+6]+semi[i+7]*a[i][i+7]);
            if(i%8==2)              
            de[i]=semi[i]*(semi[i+4]*a[i][i+4]+semi[i+5]*a[i][i+5]+semi[i+6]*a[i][i+6]+semi[i+3]*a[i][i+3]);              
             if(i%8==3)              
            de[i]=semi[i]*(semi[i+4]*a[i][i+4]+semi[i+5]*a[i][i+5]+semi[i+3]*a[i][i+3]+semi[i+2]*a[i][i+2]);             
            if(i%8==4)              
            de[i]=semi[i]*(semi[i+4]*a[i][i+4]+semi[i+3]*a[i][i+3]+semi[i+2]*a[i][i+2]+semi[i+1]*a[i][i+1]);
            if(i%8==5)              
            de[i]=semi[i]*(semi[i-4]*a[i][i-4]+semi[i-3]*a[i][i-3]+semi[i-2]*a[i][i-2]+semi[i-1]*a[i][i-1]);
            if(i%8==6)   
            de[i]=semi[i]*(semi[i-4]*a[i][i-4]+semi[i-3]*a[i][i-3]+semi[i-2]*a[i][i-2]+semi[i-5]*a[i][i-5]);
            if(i%8==7)   
            de[i]=semi[i]*(semi[i-4]*a[i][i-4]+semi[i-3]*a[i][i-3]+semi[i-6]*a[i][i-6]+semi[i-5]*a[i][i-5]);
            if(i%8==0)   
            de[i]=semi[i]*(semi[i-4]*a[i][i-4]+semi[i-7]*a[i][i-7]+semi[i-6]*a[i][i-6]+semi[i-5]*a[i][i-5]);
            
            
        }
       for(i=1;i<=16;i++)
       { if(i==1)
        { 
            final[i]=de[i]*(de[i+8]*a[i][i+8]+de[i+9]*a[i][i+9]+de[i+10]*a[i][i+10]+de[i+11]*a[i][i+11]+de[i+12]*a[i][i+12]);     
            final[i]+=de[i]*(de[i+13]*a[i][i+13]+de[i+14]*a[i][i+14]+de[i+15]*a[i][i+15]);
               
        }
        if(i==2)
        { 
            final[i]=de[i]*(de[i+8]*a[i][i+8]+de[i+9]*a[i][i+9]+de[i+10]*a[i][i+10]+de[i+11]*a[i][i+11]+de[i+12]*a[i][i+12]);     
            final[i]+=de[i]*(de[i+13]*a[i][i+13]+de[i+14]*a[i][i+14]+de[i+7]*a[i][i+7]);
               
        }
          if(i==3)
        { 
            final[i]=de[i]*(de[i+8]*a[i][i+8]+de[i+9]*a[i][i+9]+de[i+10]*a[i][i+10]+de[i+11]*a[i][i+11]+de[i+12]*a[i][i+12]);     
            final[i]+=de[i]*(de[i+13]*a[i][i+13]+de[i+6]*a[i][i+6]+de[i+7]*a[i][i+7]);
               
        }               
           if(i==4)
        { 
            final[i]=de[i]*(de[i+8]*a[i][i+8]+de[i+9]*a[i][i+9]+de[i+10]*a[i][i+10]+de[i+11]*a[i][i+11]+de[i+12]*a[i][i+12]);     
            final[i]+=de[i]*(de[i+5]*a[i][i+5]+de[i+6]*a[i][i+6]+de[i+7]*a[i][i+7]);
               
        }  
        
         if(i==5)
        { 
            final[i]=de[i]*(de[i+8]*a[i][i+8]+de[i+9]*a[i][i+9]+de[i+10]*a[i][i+10]+de[i+11]*a[i][i+11]+de[i+4]*a[i][i+4]);     
            final[i]+=de[i]*(de[i+5]*a[i][i+5]+de[i+6]*a[i][i+6]+de[i+7]*a[i][i+7]);
               
        }  
         if(i==6)
        { 
            final[i]=de[i]*(de[i+8]*a[i][i+8]+de[i+9]*a[i][i+9]+de[i+10]*a[i][i+10]+de[i+3]*a[i][i+3]+de[i+4]*a[i][i+4]);     
            final[i]+=de[i]*(de[i+5]*a[i][i+5]+de[i+6]*a[i][i+6]+de[i+7]*a[i][i+7]);
               
        }            
            if(i==7)
        { 
            final[i]=de[i]*(de[i+8]*a[i][i+8]+de[i+9]*a[i][i+9]+de[i+2]*a[i][i+2]+de[i+3]*a[i][i+3]+de[i+4]*a[i][i+4]);     
            final[i]+=de[i]*(de[i+5]*a[i][i+5]+de[i+6]*a[i][i+6]+de[i+7]*a[i][i+7]);
               
        }
             if(i==8)
        { 
            final[i]=de[i]*(de[i+8]*a[i][i+8]+de[i+1]*a[i][i+1]+de[i+2]*a[i][i+2]+de[i+3]*a[i][i+3]+de[i+4]*a[i][i+4]);     
            final[i]+=de[i]*(de[i+5]*a[i][i+5]+de[i+6]*a[i][i+6]+de[i+7]*a[i][i+7]);
               
        }    
                 if(i==9)
        { 
            final[i]=de[i]*(de[i-8]*a[i][i-8]+de[i-1]*a[i][i-1]+de[i-2]*a[i][i-2]+de[i-3]*a[i][i-3]+de[i-4]*a[i][i-4]);     
            final[i]+=de[i]*(de[i-5]*a[i][i-5]+de[i-6]*a[i][i-6]+de[i-7]*a[i][i-7]);
               
        }   
                 if(i==10)
        { 
            final[i]=de[i]*(de[i-8]*a[i][i-8]+de[i-9]*a[i][i-9]+de[i-2]*a[i][i-2]+de[i-3]*a[i][i-3]+de[i-4]*a[i][i-4]);     
            final[i]+=de[i]*(de[i-5]*a[i][i-5]+de[i-6]*a[i][i-6]+de[i-7]*a[i][i-7]);
               
        }   
                 if(i==11)
        { 
            final[i]=de[i]*(de[i-8]*a[i][i-8]+de[i-9]*a[i][i-9]+de[i-10]*a[i][i-10]+de[i-3]*a[i][i-3]+de[i-4]*a[i][i-4]);     
            final[i]+=de[i]*(de[i-5]*a[i][i-5]+de[i-6]*a[i][i-6]+de[i-7]*a[i][i-7]);
               
        }   
                if(i==12)
        { 
            final[i]=de[i]*(de[i-8]*a[i][i-8]+de[i-9]*a[i][i-9]+de[i-10]*a[i][i-10]+de[i-11]*a[i][i-11]+de[i-4]*a[i][i-4]);     
            final[i]+=de[i]*(de[i-5]*a[i][i-5]+de[i-6]*a[i][i-6]+de[i-7]*a[i][i-7]);
               
        }   
                if(i==13)
        { 
            final[i]=de[i]*(de[i-8]*a[i][i-8]+de[i-9]*a[i][i-9]+de[i-10]*a[i][i-10]+de[i-11]*a[i][i-11]+de[i-12]*a[i][i-12]);     
            final[i]+=de[i]*(de[i-5]*a[i][i-5]+de[i-6]*a[i][i-6]+de[i-7]*a[i][i-7]);
               
        }    
                if(i==14)
        { 
            final[i]=de[i]*(de[i-8]*a[i][i-8]+de[i-9]*a[i][i-9]+de[i-10]*a[i][i-10]+de[i-11]*a[i][i-11]+de[i-12]*a[i][i-12]);     
            final[i]+=de[i]*(de[i-13]*a[i][i-13]+de[i-6]*a[i][i-6]+de[i-7]*a[i][i-7]);
               
        }   
                if(i==15)
        { 
            final[i]=de[i]*(de[i-8]*a[i][i-8]+de[i-9]*a[i][i-9]+de[i-10]*a[i][i-10]+de[i-11]*a[i][i-11]+de[i-12]*a[i][i-12]);     
            final[i]+=de[i]*(de[i-13]*a[i][i-13]+de[i-14]*a[i][i-14]+de[i-7]*a[i][i-7]);
               
        }     
               if(i==16)
        { 
            final[i]=de[i]*(de[i-8]*a[i][i-8]+de[i-9]*a[i][i-9]+de[i-10]*a[i][i-10]+de[i-11]*a[i][i-11]+de[i-12]*a[i][i-12]);     
            final[i]+=de[i]*(de[i-13]*a[i][i-13]+de[i-14]*a[i][i-14]+de[i-15]*a[i][i-15]);
               
        }   
         printf("%-10s ",c[i]);
         printf("p=%.2f",final[i]*100.0);
         cout<<"%"<<endl;                     
       }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator