Advertisement
Guest User

Untitled

a guest
May 26th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package fraktal;
  7.  
  8. import java.io.BufferedReader;
  9. import java.io.IOException;
  10. import java.io.InputStreamReader;
  11. import static java.lang.Math.sqrt;
  12. import java.text.DecimalFormat;
  13. import java.util.ArrayList;
  14. import java.util.List;
  15. import java.util.Locale;
  16. import java.util.Random;
  17.  
  18. /**
  19. *
  20. * @author HP
  21. */
  22. public class Fraktal {
  23.  
  24. /**
  25. * @param args the command line arguments
  26. */
  27.  
  28.  
  29. public static void main(String[] args) throws IOException {
  30. // TODO code application logic here
  31. BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  32. int ile, d=0;
  33. double i = sqrt(-1);
  34. double rzeczywista,urojona;
  35. double x;
  36. String line = br.readLine();
  37. ile = Integer.parseInt(line.split(" ")[0]);
  38. while(ile>d)
  39. {
  40.  
  41. line = br.readLine();
  42. x= Double.parseDouble(line.split(" ")[0]);
  43. rzeczywista = Math.cos(Math.log(x));
  44. urojona = Math.sin(Math.log(x));
  45. rzeczywista *= 100; // pi = pi * 100;
  46. rzeczywista= Math.round(rzeczywista);
  47. rzeczywista /= 100;
  48. urojona *= 100; // pi = pi * 100;
  49. urojona= Math.round(urojona);
  50. urojona /= 100;
  51. System.out.println(rzeczywista + " " + urojona);
  52.  
  53. d++;
  54. }
  55. }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement