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 |
矩阵WA的:一定要注意取模的问题inline void Read(Mat &A){ for(int i=1;i<=n;i++) for(int j=1;j<=n;j++){ scanf("%d",&A.a[i][j]); A.a[i][j]%=m; } } 在读入的时候要记得取个模 否则会WA inline void Print(Mat &A){ for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i==j)A.a[i][j+n]--; // while(A.a[i][j+n]<0)A.a[i][j+n]+=m; //在这里取不取模均可,(虽然不取模会导致出现负数) if(j==1)printf("%d",A.a[i][j+n]); else printf(" %d",A.a[i][j+n]); } printf("\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator