10879 - Code Refactoring
Problem Link: Click Here!
Solution:
#include<stdio.h>int main(void){
int i,t,m,ao[5];
long long int a,j;
scanf("%d",&t);
i=1;
while(i<=t){
m=0;
scanf("%lld",&a);
for(j=2;j<=a/2;j++){
if(a%j==0){
ao[m]=j;
ao[++m]=a/j;
m++;
}
if(m==4)break;
}
printf("Case #%d: %lld = %d * %d = %d * %d\n",i,a,ao[0],ao[1],ao[2],ao[3]);
i++;
}
return 0;
}
No comments:
Post a Comment