Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- int main(i)
- {
- int mt[100];
- int ne[100];
- int x,y,z,w,j,temp=0;
- memset(mt,0,sizeof(mt));
- memset(ne,0,sizeof(ne));
- scanf("%d%d%d%d%d%d",&mt[0],&ne[0],&w,&x,&y,&z);
- for(i=1;i<=w;i++)
- {
- for(j=y;j>0;j--) mt[j]=mt[j-1];
- for(j=x;j>0;j--) ne[j]=ne[j-1];
- mt[0]=mt[y]+ne[x];
- ne[0]=mt[y]*z;
- mt[y]=0;ne[x]=0;
- }
- for(j=y;j>=0;j--) temp+=mt[j];
- for(j=x;j>=0;j--) temp+=ne[j];
- printf("%d\n",temp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment