What’s wrong in my code. I have tried all testcase but it gets failed every time on code chief. Please guide me that where I am doing wrong…
My program…
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int testCase=0;
cin>>testCase;
int col=0;
int arr[100][100];
int arr1[100][100];
for(int i=0;i<testCase;i++){
int input_case=0;
scanf("%d",&input_case);
int minvalue=1000000;
int count=0;
for(int j=0;j<input_case;j++){
scanf("%d",&arr[i][j]);
if(minvalue>arr[i][j]){
minvalue=arr[i][j];
}
if(arr[i][j]%minvalue==0){
arr1[i][j]=arr[i][j];
arr[i][j]=arr[i][j]/minvalue;
count++;
}
else{
arr1[i][j]=arr[i][j];
}
}
if(count==input_case){
for(int j=0;j<input_case;j++){
printf("%d ",arr[i][j]);
}
}
else{
for(int j=0;j<input_case;j++){
printf("%d ",arr1[i][j]);
}
}
printf("\n");
}
return 0;
}
Contest Code:PRACTICE
Problem Code:RECIPE