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 |
看了这么久的discuss还没发过,这里小贴一下这道题0MS的代码,仅供参考#include <iostream> using namespace std; int main() { char a[16][11]; int n=16,i,j; float tmp,s[16][16],res4[16],res2[16],res1[16]; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<16;i++) for(j=0;j<16;j++) { cin>>tmp; s[i][j]=tmp/100; } for(i=0;i<16;i++) { res4[i]=s[i][(i+1)%2+i/2*2]*(s[i][(i+2)%4+i/4*4]*s[(i+2)%4+i/4*4][(((i+2)%4+i/4*4)+1)%2+((i+2)%4+i/4*4)/2*2]+s[i][(((i+2)%4+i/4*4)+1)%2+((i+2)%4+i/4*4)/2*2]*s[(((i+2)%4+i/4*4)+1)%2+((i+2)%4+i/4*4)/2*2][(i+2)%4+i/4*4]); } for(i=0;i<16;i++) { res2[i]=res4[i]*(s[i][(i/4*4+4)%8+i/8*8]*res4[(i/4*4+4)%8+i/8*8]+s[i][(i/4*4+5)%8+i/8*8]*res4[(i/4*4+5)%8+i/8*8]+s[i][(i/4*4+6)%8+i/8*8]*res4[(i/4*4+6)%8+i/8*8]+s[i][(i/4*4+7)%8+i/8*8]*res4[(i/4*4+7)%8+i/8*8]); } for(i=0;i<16;i++) { res1[i]=res2[i]*(s[i][(i/8*8+8)%16+i/16*16]*res2[(i/8*8+8)%16+i/16*16]+s[i][(i/8*8+9)%16+i/16*16]*res2[(i/8*8+9)%16+i/16*16]+s[i][(i/8*8+10)%16+i/16*16]*res2[(i/8*8+10)%16+i/16*16]+s[i][(i/8*8+11)%16+i/16*16]*res2[(i/8*8+11)%16+i/16*16]+s[i][(i/8*8+12)%16+i/16*16]*res2[(i/8*8+12)%16+i/16*16]+s[i][(i/8*8+13)%16+i/16*16]*res2[(i/8*8+13)%16+i/16*16]+s[i][(i/8*8+14)%16+i/16*16]*res2[(i/8*8+14)%16+i/16*16]+s[i][(i/8*8+15)%16+i/16*16]*res2[(i/8*8+15)%16+i/16*16]); printf("%-10s p=%.2f%%\n",a[i],res1[i]*100); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator