View difference between Paste ID: xQ25yfEf and DeaVBrBu
SHOW: | | - or go back to the newest paste.
1
#include <stdio.h>
2
#include <stdlib.h>
3
4
int ubaci(int n, int a)
5-
int pljuniId(int* nums, int cnt) {
5+
6-
    int i;
6+
    int cifra[20], i, b=n,brojac=0,novibroj=0;
7
8-
    int max = nums[0] % 10, maxId = 0;  //pretpostavljamo
8+
     while(n!=0)
9-
    int cif;
9+
      {
10
          n/=10;
11-
    for ( i = 0; i < cnt; i ++ ) {  //idemo broj po broj.
11+
          brojac++;
12-
        while ( nums[i] != 0 ) {  //idemo cifru po cifru.
12+
      }
13-
            cif = nums[i] % 10;
13+
      n=b;
14-
            if ( cif > max ) {
14+
      for(i=0;i<brojac;i++)
15-
                    max = cif;
15+
      {
16-
                    maxId = i;
16+
          cifra[i]=n%10;
17-
            }
17+
          n/=10;
18-
            else if ( cif == max ) {
18+
          if(i%2!=0) cifra[i]=a;
19-
                while ( (nums[maxId] % 10) == (nums[i] % 10) ) {
19+
          novibroj+=cifra[i]*10;
20-
                    nums[maxId] /= 10;
20+
      }
21-
                    nums[i] /= 10;
21+
      return novibroj;
22
}
23-
                    if ( nums[i] == 0 ) break;
23+
24-
                }
24+
25
{
26-
            }
26+
   int x,y;
27-
            nums[i] /= 10;
27+
 scanf("%d",&x);
28-
        }
28+
 scanf("%d",&y);
29-
    }
29+
30
 printf("%d",ubaci(x,y));
31-
    return maxId;
31+
32
}