Guest User

Untitled

a guest
Apr 26th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.23 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int utikoltseg(unsigned int tavolsag){
  4. return (int) ((ceil(sqrt(tavolsag)/1000))*2);
  5. }
  6. int main(){
  7. printf("%d\n", (2995-4517)*(2995-4517)+(6813-4839)*(6813-4839));
  8. printf("%f\n", sqrt((2995-4517)*(2995-4517)+(6813-4839)*(6813-4839)));
  9. printf("%f\n", sqrt((2995-4517)*(2995-4517)+(6813-4839)*(6813-4839))/1000);
  10. printf("%f\n", ceil(sqrt((2995-4517)*(2995-4517)+(6813-4839)*(6813-4839))/1000));
  11. printf("%f\n", ceil(sqrt((2995-4517)*(2995-4517)+(6813-4839)*(6813-4839))/1000)*2);
  12. printf("%d\n", (int) utikoltseg((2995-4517)*(2995-4517)+(6813-4839)*(6813-4839)) );
  13.     getchar();
  14.     return 0;
  15. }
  16.  
  17.  
  18. unsigned int tavkereso(bazis *fobazis, hazikok *egyhaz){
  19.     hazikok *keresetthaz=egyhaz;
  20.     hazikok *elsohaz;
  21.     hazikok hazu;
  22.     hazikok *bazishaz=&hazu;
  23.     hazikok *mozgo;
  24.     bazishaz->x=fobazis->x;
  25.     bazishaz->y=fobazis->y;
  26.     elsohaz=legkozelebbihaz2(fobazis->elsohaz,bazishaz);
  27.     elsohaz->jartitt=1;
  28.     mozgo=elsohaz;
  29. if(mozgo==keresetthaz){
  30.     return tavnegyzet(bazishaz->x,bazishaz->y,mozgo->x,mozgo->y);
  31. }
  32. else{
  33.     while (legkozelebbihaz3(fobazis->elsohaz,mozgo)!=keresetthaz){
  34.         mozgo=legkozelebbihaz2(fobazis->elsohaz,mozgo);
  35.        
  36.     }
  37.     return tavnegyzet(mozgo->x,mozgo->y,keresetthaz->x,keresetthaz->y);
  38. }
  39.  
  40. }
Add Comment
Please, Sign In to add comment