Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int utikoltseg(unsigned int tavolsag){
- return (int) ((ceil(sqrt(tavolsag)/1000))*2);
- }
- int main(){
- printf("%d\n", (2995-4517)*(2995-4517)+(6813-4839)*(6813-4839));
- printf("%f\n", sqrt((2995-4517)*(2995-4517)+(6813-4839)*(6813-4839)));
- printf("%f\n", sqrt((2995-4517)*(2995-4517)+(6813-4839)*(6813-4839))/1000);
- printf("%f\n", ceil(sqrt((2995-4517)*(2995-4517)+(6813-4839)*(6813-4839))/1000));
- printf("%f\n", ceil(sqrt((2995-4517)*(2995-4517)+(6813-4839)*(6813-4839))/1000)*2);
- printf("%d\n", (int) utikoltseg((2995-4517)*(2995-4517)+(6813-4839)*(6813-4839)) );
- getchar();
- return 0;
- }
- unsigned int tavkereso(bazis *fobazis, hazikok *egyhaz){
- hazikok *keresetthaz=egyhaz;
- hazikok *elsohaz;
- hazikok hazu;
- hazikok *bazishaz=&hazu;
- hazikok *mozgo;
- bazishaz->x=fobazis->x;
- bazishaz->y=fobazis->y;
- elsohaz=legkozelebbihaz2(fobazis->elsohaz,bazishaz);
- elsohaz->jartitt=1;
- mozgo=elsohaz;
- if(mozgo==keresetthaz){
- return tavnegyzet(bazishaz->x,bazishaz->y,mozgo->x,mozgo->y);
- }
- else{
- while (legkozelebbihaz3(fobazis->elsohaz,mozgo)!=keresetthaz){
- mozgo=legkozelebbihaz2(fobazis->elsohaz,mozgo);
- }
- return tavnegyzet(mozgo->x,mozgo->y,keresetthaz->x,keresetthaz->y);
- }
- }
Add Comment
Please, Sign In to add comment