-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HW1_done #14
base: master
Are you sure you want to change the base?
HW1_done #14
Changes from all commits
98b24d8
e503c11
acc3464
8799a43
7f837c1
37593ef
b75ec08
8700a08
019f618
81b9696
ee4caf7
3aed8cb
2baea2a
2171f98
4abd5c1
cb12feb
479aac0
d142eb7
262edc9
716187b
6235854
b2e70d1
178929e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
public class Task1 { | ||
public static double calculateP(double a) { | ||
return 0; | ||
|
||
return 4 * a; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
public class Task2 { | ||
public static int getMeters(int centimeters) { | ||
return 0; | ||
|
||
return centimeters / 100; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,14 @@ | |
public class Task4 { | ||
|
||
public static double getSumOfGreatest(double a, double b, double c) { | ||
return 0; | ||
} | ||
} | ||
if (a < b && b < c) { | ||
return c + b; | ||
} | ||
if (a > b && b > c) { | ||
return b + a; | ||
} | ||
else { | ||
return a + c; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please format you code before commit, you can use IDEA shortcut: |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,10 @@ | |
|
||
public class Task5 { | ||
public static double calculateA(double x, double y, double z) { | ||
return 0; | ||
return ((2 * Math.sin(x - Math.PI / 6) * calculateB(z)) / (1 / 2.0 + (Math.pow(Math.sin(y), 2)))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's quite hard to read such expressions. It'll be easier for understanding if you'll split it into some pretty parts, like But, anyway, it do pass all the tests. |
||
} | ||
|
||
private static double calculateB(double z) { | ||
return 0; | ||
return 1 + (Math.pow(z, 2)) / (3 + ((Math.pow(z, 2)) / 5)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,15 @@ | |
public class Task9 { | ||
|
||
public static boolean isPowerOfThree(int n) { | ||
return false; | ||
} | ||
|
||
if (n <= 1){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return false; | ||
} | ||
|
||
while (n>1 && (n % 3) == 0) { | ||
n = n / 3; | ||
} | ||
return n == 1; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not correct solution.
It'll loop forever for some numbers, for example, when
n=27
:n>0
->true
-> go into while loopn%10 == 2
->false
-> do not dividen
by10
-> go to step 1.