|
|
back to boardI am SUPERProgrammer :)))) Posted by XSpider 28 Mar 2008 00:28 My solve AC with 0.0001 and 528 kb #include <iostream.h> #include <math.h> #include <stdlib.h> int fcmp (const void* a, const void* b) { return *(int*)a - *(int*)b; } int main() { int a[10], div[100000], count=0, i; for (i=0; i<10; i++) cin>>a[i]; for (i=0; i<10; i++) { while (a[i]%2==0) { div[count++] = 2; a[i] /= 2; } int j=3; while (j <= sqrt( (double)a[i] ) + 1) { if (a[i]%j==0) { div[count++]=j; a[i] /= j; } else j += 2; } if (a[i]>1) div[count++]=a[i]; } qsort(div, count, sizeof(int), fcmp); int proiz=1, temp=1; for (i=0; i<count; i++) { if (div[i]==div[i+1]) temp++; else { proiz *= (temp+1)%10; temp=1;} } cout<<proiz%10; return 0; } |
|
|