Advertisement
Guest User

Untitled

a guest
Jan 16th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <stdio.h>
  2. int prva(int x){
  3. int pot=1;
  4. if(x<0) x=-x;
  5. while(x>=pot) pot*=10;
  6. pot/=10;
  7. return x/pot;
  8. }
  9. int najveci(int a[], int n){
  10. int i, k=0, abs, max;
  11. for(i=0; i<n; i++){
  12. abs=(a[i]<0 ? -a[i]:a[i]);
  13. if(abs%14==0) {
  14. if (k==0) {max=a[i];k++;}
  15. else if(a[i]>max) max=a[i];
  16. }
  17. }
  18. if(k==0) return 0;
  19.  
  20. return max;
  21. }
  22.  
  23. int main(void){
  24. int n, a[130], i, temp, max;
  25.  
  26. scanf("%d", &n);
  27.  
  28. for(i=0; i<n; i++)
  29. scanf("%d", &a[i]);
  30.  
  31. if(najveci(a, n)==0) return 0;
  32. max=najveci(a, n);
  33. printf("%d ", max);
  34.  
  35. if(max<0) max=-max;
  36. temp=max;
  37. for(i=0; i<n; i++){
  38. temp=max;
  39. while(temp>0){
  40. if(temp%10==prva(a[i])) {printf("%d ", i);break;}
  41. temp/=10;
  42. }
  43. }
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement