Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int prva(int x){
- int pot=1;
- if(x<0) x=-x;
- while(x>=pot) pot*=10;
- pot/=10;
- return x/pot;
- }
- int najveci(int a[], int n){
- int i, k=0, abs, max;
- for(i=0; i<n; i++){
- abs=(a[i]<0 ? -a[i]:a[i]);
- if(abs%14==0) {
- if (k==0) {max=a[i];k++;}
- else if(a[i]>max) max=a[i];
- }
- }
- if(k==0) return 0;
- return max;
- }
- int main(void){
- int n, a[130], i, temp, max;
- scanf("%d", &n);
- for(i=0; i<n; i++)
- scanf("%d", &a[i]);
- if(najveci(a, n)==0) return 0;
- max=najveci(a, n);
- printf("%d ", max);
- if(max<0) max=-max;
- temp=max;
- for(i=0; i<n; i++){
- temp=max;
- while(temp>0){
- if(temp%10==prva(a[i])) {printf("%d ", i);break;}
- temp/=10;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement