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