The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled C Code
Posted by: powerasdf | December 7, 2010 @ 4:11am
C Code
[
Download
]
void power(int matrix[SIZE][SIZE], int result[SIZE][SIZE], int n, int p) { int i,j; int matrix2[SIZE][SIZE]; if(p==0) for(i=0;i<n;i++)for(j=0;j<n;j++) result[i][j]=i==j; /* result = matrix*/ else{ power(matrix,result,n,p/2); multiply(result,result,matrix2,n,n,n); if(p%2==1) multiply(matrix2,matrix,result,n,n,n); else{ for(i=0;i<n;i++)for(j=0;j<n;j++) result[i][j]=matrix2[i][j]%1000; } } }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.29 / 8
38 Votes
http://codebin.yi.org/1000
page generated in 0.00 seconds