#include #include #include int main (void) { /* int stime; long int ltime; ltime=time(NULL); stime=(unsigned) ltime/2; srand(stime); int min, max; int sumelema = 0; */ int m[40]; int a, *p; p = m; int sum = 0; int sumelemb = 0; double mvar; /* scanf("%d", &min); scanf("%d", &max); scanf("%d", &a); for (int i=0;i<40;++i) { m[i] = (min + rand()%(max-min+1)); if (m[i]%a == 0) sum += m[i]; printf("%2d ", i); printf("%d\n", m[i]); } mvar = ((double)sum)/40; for (int i=0;i<40;++i) { if (m[i]>(int)mvar) sumelema += m[i]; if (*(p+i)>(int)mvar) sumelemb += *(p+i); } printf("%.4f\n", mvar); printf("%d\n", sumelema); printf("%d\n", sumelemb); */ for (int i=0; i<40; ++i) scanf("%d", &m[i]); scanf("%d", &a); for (int i=0;i<40;++i) if (m[i]%a == 0) sum += m[i]; mvar = ((double)sum)/40; for (int i=0;i<40;++i) if (*(p+i)>(int)mvar) sumelemb += *(p+i); printf("%.4f\n", mvar); printf("%d\n", sumelemb); return(0); }