Advertisement
TwiNNeR

(CLEAN) Motherfucker zadacha C

Oct 27th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.94 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. #define MAX 100
  6.  
  7. int main()
  8. {
  9.     int n,a[MAX];
  10.     scanf("%d",&n);
  11.     int i;
  12.  
  13.     for(i=0;i<n;i++)
  14.         scanf("%d",&a[i]);
  15.  
  16.     int pom=0,ilok=0,dlok=0,prpom=1;
  17.     int j;
  18.     int proizvod;
  19.     int br=1;
  20.     for(i=0;i<n;i++)
  21.     {
  22.         proizvod=1; br=1;
  23.         for(j=i;j<n;j++)
  24.         {
  25.  
  26.             if(a[j]<a[j+1])
  27.             {
  28.                 br++;
  29.                 proizvod=proizvod*a[j];
  30.             }
  31.             else
  32.             {
  33.                 if(br>pom)
  34.                 {
  35.                     proizvod=proizvod*a[j];
  36.                     pom=br;
  37.                     ilok=j;
  38.                     dlok=i;
  39.                     prpom=proizvod;
  40.                 }
  41.                 break;
  42.             }
  43.         }
  44.     }
  45.  
  46.     printf("pochnuva od %d trae do %d i geo.sred. e %f",a[dlok],a[ilok],pow(prpom,1.0/(float)pom));
  47.    
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement