Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- void mul(int *a11,int *a12,int *a21,int *a22,int w11,int w12,int w21,int w22){
- int t11 = *a11 * w11 + *a12 * w21;
- int t12 = *a11 * w12 + *a12 * w22;
- int t21 = *a21 * w11 + *a22 * w21;
- int t22 = *a21 * w12 + *a22 * w22;
- *a11 = t11;
- *a12 = t12;
- *a21 = t21;
- *a22 = t22;
- }
- int main(){
- int n;
- while(scanf(" %d",&n)){
- int a11=1,a12=1,a21=1,a22=0;
- for(int i=0;i<n;i++){
- printf("%d ",a12);
- mul(&a11, &a12, &a21, &a22, 1, 1, 1, 0);
- }
- printf("%d",a12);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement