-
Notifications
You must be signed in to change notification settings - Fork 102
Lesson 2 #49
Lesson 2 #49
Conversation
recheck all |
authorAlex [korneev.ry@yandex.ru] lesson1.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 9 / 12 Example: 4 / 4 Succeeded:
Failed:
Seed: -7606361675669160907 lesson2.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 1 / 7 Example: 1 / 1 Succeeded:
Failed:
Seed: -7606361675669160907 ownerSeveNChaK [] |
recheck all |
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun seconds(hours: Int, minutes: Int, seconds: Int): Int = TODO() | ||
fun seconds(hours: Int, minutes: Int, seconds: Int): Int { | ||
val x1 = hours * 60 * 60 |
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.
Переменным лучше давать осмысленные имена
authorAlex [korneev.ry@yandex.ru] lesson1.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 10 / 12 Example: 4 / 4 Succeeded:
Seed: -3955448798949467784 lesson2.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 2 / 7 Example: 1 / 1 Succeeded:
Failed:
Seed: -3955448798949467784 ownerSeveNChaK [] |
src/lesson1/task1/Simple.kt
Outdated
* Например, 100 рублей под 10% годовых превратятся в 133.1 рубля | ||
*/ | ||
fun accountInThreeYears(initial: Int, percent: Int): Double = TODO() | ||
fun accountInThreeYears(initial: Int, percent: Int): Double = TODO() |
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.
В коммитах лучше избегать ненужных изменений, так как они усложняют объединение наборов изменений от разных разработчиков
recheck all |
authorAlex [korneev.ry@yandex.ru] lesson1.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 10 / 12 Example: 4 / 4 Succeeded:
Seed: -2773410453390593234 lesson2.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 3 / 7 Example: 1 / 1 Succeeded:
Seed: -2773410453390593234 ownerSeveNChaK [] |
Изначально что-то не прошло, а в сообщение позже уже все нормально. Как это понимать? Подскажите, пожалуйста. |
Проверяющая система использует случайное тестирование, и на разных запусках может проверять ваш код на разных входных значениях. В вашем коде все еще есть ошибка, найденная при первом запуске. |
Автору PR: вы отстаёте от графика. Вам следует исправить имеющиеся замечания, закончить с заданиями 2-го урока и перейти к решению задач 3-го урока. |
authorAlex [korneev.ry@yandex.ru] lesson3.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 14 / 18 Example: 4 / 4 Succeeded:
Failed:
Seed: -5620831687848804632 ownerSeveNChaK [] |
recheck all |
authorAlex [korneev.ry@yandex.ru] lesson1.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 10 / 12 Example: 4 / 4 Succeeded:
Seed: -6777597016495018913 lesson2.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 2 / 7 Example: 1 / 1 Succeeded:
Failed:
Seed: -6777597016495018913 lesson2.task2Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 4 / 5 Example: 1 / 1 Succeeded:
Failed:
Seed: -6777597016495018913 lesson3.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 14 / 18 Example: 4 / 4 Succeeded:
Failed:
Seed: -6777597016495018913 ownerSeveNChaK [] |
authorAlex [korneev.ry@yandex.ru] lesson3.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 15 / 18 Example: 4 / 4 Succeeded:
Seed: -6331706759773008094 ownerSeveNChaK [] |
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.
Дальнейшие задачи будут проверяться только после исправления имеющихся замечаний
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun lengthInMeters(sagenes: Int, arshins: Int, vershoks: Int): Double = TODO() | ||
fun lengthInMeters(sagenes: Int, arshins: Int, vershoks: Int): Double { | ||
val s=sagenes*48 |
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.
Форматирование кода должно быть одинаковым везде --- если вы отделяете знаки операций от операндов пробелами, то делайте это везде. Попробуйте отформатировать ваш код при помощи IntelliJ IDEA и в дальнейшем придерживайтесь такого же стиля кодирования.
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun thirdDigit(number: Int): Int = TODO() | ||
fun thirdDigit(number: Int): Int { | ||
return number%1000/100 |
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.
Функцию с телом в виде одного return expr
можно записать как fun foo(...) = expr
src/lesson2/task1/IfElse.kt
Outdated
t3: Double, v3: Double): Double { | ||
val ps:Double = (t1*v1+t2*v2+t3*v3)/2 | ||
var t:Double | ||
if (t1*v1 < ps) |
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.
Форматирование кода
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.
Данное выражение лучше оформить как when
src/lesson2/task1/IfElse.kt
Outdated
t3: Double, v3: Double): Double = TODO() | ||
t3: Double, v3: Double): Double { | ||
val ps:Double = (t1*v1+t2*v2+t3*v3)/2 | ||
var t:Double |
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.
Можно обойтись без этой переменной, если все возвращать сразу
src/lesson2/task2/Logical.kt
Outdated
*/ | ||
fun isNumberHappy(number: Int): Boolean = TODO() | ||
fun isNumberHappy(number: Int): Boolean { | ||
val x4:Int = number%10 |
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.
- Система типов Котлина выведет тип переменной автоматически
src/lesson3/task1/Loop.kt
Outdated
*/ | ||
fun isCoPrime(m: Int, n: Int): Boolean = TODO() | ||
fun isCoPrime(m: Int, n: Int): Boolean { | ||
var a: Int = m |
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.
Что делает данная функция по сути? Объясните своими словами в комментарии.
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.
Через алгоритм Евклида находит НОД и если он единица, то числа взаимно простые.
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.
- Объясните, что делает ваш новый код, в комментарии
- Нельзя ли вынести часть функциональности вашей функции в отдельную функцию, которая могла бы помочь при решении других задач?
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.
В коде ничего не поменялось в этой задаче, все также алгоритм Евклида
src/lesson3/task1/Loop.kt
Outdated
var revertNumber = 0 | ||
var number = n | ||
while (k >= 0) { | ||
revertNumber = revertNumber + Math.pow(10.0, k.toDouble()).toInt() * (number % 10) |
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.
Напишите pow
, который работает в Int
src/lesson3/task1/Loop.kt
Outdated
* 15751 -- палиндром, 3653 -- нет. | ||
*/ | ||
fun isPalindrome(n: Int): Boolean = TODO() | ||
fun isPalindrome(n: Int): Boolean = if (revert(n) == n) true else false |
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.
Выражение if (cond) true else false
можно заменить на cond
src/lesson3/task1/Loop.kt
Outdated
} | ||
count = sum - n | ||
if (count != 0) { | ||
number = square.toDouble() / Math.pow(10.0, count.toDouble()) |
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.
pow(Int, Int)
src/lesson3/task1/Loop.kt
Outdated
} | ||
count = sum - n | ||
if (count != 0) { | ||
number = fibn.toDouble() / Math.pow(10.0, count.toDouble()) |
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.
pow(Int, Int)
authorAlex [korneev.ry@yandex.ru] lesson1.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 10 / 12 Example: 4 / 4 Succeeded:
Seed: -6264856230449157656 lesson2.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 3 / 7 Example: 1 / 1 Succeeded:
Seed: -6264856230449157656 lesson2.task2Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 3 / 5 Example: 1 / 1 Succeeded:
Failed:
Seed: -6264856230449157656 lesson3.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 15 / 18 Example: 4 / 4 Succeeded:
Seed: -6264856230449157656 ownerSeveNChaK [] |
Обратите внимание, что ваш код не проходит один из встроенных в проект тестов. В дальнейшем проверяйте ваш код на работоспособность локально, у себя на машине, при помощи запуска встроенных тестов в IDE. |
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun seconds(hours: Int, minutes: Int, seconds: Int): Int = TODO() | ||
fun seconds(hours: Int, minutes: Int, seconds: Int): Int { | ||
val x1 = hours * 60 * 60 |
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.
Переменным лучше давать осмысленные имена, соответствующие их назначению в коде
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun lengthInMeters(sagenes: Int, arshins: Int, vershoks: Int): Double = TODO() | ||
fun lengthInMeters(sagenes: Int, arshins: Int, vershoks: Int): Double { | ||
val s = sagenes * 48 |
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.
Переменным лучше давать осмысленные имена, соответствующие их назначению в коде
src/lesson2/task1/IfElse.kt
Outdated
t2: Double, v2: Double, | ||
t3: Double, v3: Double): Double = TODO() | ||
t3: Double, v3: Double): Double { | ||
val ps = (t1 * v1 + t2 * v2 + t3 * v3) / 2 |
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.
Повторно вычисляемые подвыражения лучше вынести в отдельные переменные
src/lesson2/task1/IfElse.kt
Outdated
fun segmentLength(a: Int, b: Int, c: Int, d: Int): Int = TODO() | ||
fun segmentLength(a: Int, b: Int, c: Int, d: Int): Int { | ||
|
||
if ((c in a..b) && (d in a..b)) { |
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.
Данное выражение лучше оформить как when
src/lesson2/task2/Logical.kt
Outdated
package lesson2.task2 | ||
|
||
import lesson1.task1.sqr | ||
import lesson4.task1.abs |
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.
Зачем вам здесь этот импорт?
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.
Никогда не добавлял импорт ни в один урок, он сам
src/lesson3/task1/Loop.kt
Outdated
fun lcm(m: Int, n: Int): Int = TODO() | ||
fun lcm(m: Int, n: Int): Int { | ||
var k = Math.min(n, m) | ||
val min = Math.min(m, n) |
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.
Зачем два раза вызывать min(m, n)
?
src/lesson3/task1/Loop.kt
Outdated
val min = Math.min(m, n) | ||
while (true) { | ||
if ((k % m == 0) && (k % n == 0)) return k | ||
else k = k + min |
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.
Почитайте про более быстрые алгоритмы поиска НОК
src/lesson3/task1/Loop.kt
Outdated
*/ | ||
fun maxDivisor(n: Int): Int = TODO() | ||
fun maxDivisor(n: Int): Int { | ||
var res = 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.
Нет ли более точной верхней границы для возможных делителей, чем n
?
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.
Не понял вопроса
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.
Если мы ищем делители числа n
, не равные n
, какое максимальное значение может принимать любой другой делитель?
src/lesson3/task1/Loop.kt
Outdated
*/ | ||
fun isCoPrime(m: Int, n: Int): Boolean = TODO() | ||
fun isCoPrime(m: Int, n: Int): Boolean { | ||
var a: Int = m |
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.
- Объясните, что делает ваш новый код, в комментарии
- Нельзя ли вынести часть функциональности вашей функции в отдельную функцию, которая могла бы помочь при решении других задач?
src/lesson3/task1/Loop.kt
Outdated
var revertNumber = 0 | ||
var number = n | ||
while (k >= 0) { | ||
revertNumber = revertNumber + pow(10, k) * (number % 10) |
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.
Почему бы вместо переменной k
и постоянного возведения в степень не начать с требуемой степени десятки и уменьшать ее на 10 каждый раз?
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.
Хорошая идея:)
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.
Ничего не менял в той задаче, все также через алгоритм Евклида
src/lesson3/task1/Loop.kt
Outdated
*/ | ||
fun isCoPrime(m: Int, n: Int): Boolean = TODO() | ||
fun isCoPrime(m: Int, n: Int): Boolean { | ||
var a: Int = m |
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.
Через алгоритм Евклида находит НОД и если он единица, то числа взаимно простые.
authorAlex [korneev.ry@yandex.ru] lesson1.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 10 / 12 Example: 4 / 4 Succeeded:
Seed: 4397626888305790086 lesson2.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 2 / 7 Example: 1 / 1 Succeeded:
Failed:
Seed: 4397626888305790086 lesson2.task2Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 5 / 5 Example: 1 / 1 Succeeded:
Seed: 4397626888305790086 lesson3.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 15 / 18 Example: 4 / 4 Succeeded:
Seed: 4397626888305790086 ownerSeveNChaK [] |
authorAlex [korneev.ry@yandex.ru] lesson2.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 3 / 7 Example: 1 / 1 Succeeded:
Seed: 4580750298525503986 ownerSeveNChaK [] |
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun seconds(hours: Int, minutes: Int, seconds: Int): Int = TODO() | ||
fun seconds(hours: Int, minutes: Int, seconds: Int): Int { | ||
val hour = hours * 60 * 60 |
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.
Переменным лучше давать осмысленные имена, соответствующие их назначению в коде. Это не час, это количество секунд в заданном количестве часов.
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun lengthInMeters(sagenes: Int, arshins: Int, vershoks: Int): Double = TODO() | ||
fun lengthInMeters(sagenes: Int, arshins: Int, vershoks: Int): Double { | ||
val sagene = sagenes * 48 |
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.
См. замечание выше
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun trackLength(x1: Double, y1: Double, x2: Double, y2: Double): Double = TODO() | ||
fun trackLength(x1: Double, y1: Double, x2: Double, y2: Double): Double { | ||
val sx = abs(x1 - x2) |
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.
Зачем брать модуль перед возведением в квадрат?
src/lesson2/task1/IfElse.kt
Outdated
val part2 = t2 * v2 | ||
val part3 = t3 * v3 | ||
val ps = (part1 + part2 + part3) / 2 | ||
when { |
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.
Вместо when { ... return ... return ... return ... }
лучше сделать return when { ... }
(a >= c) && (b <= d) -> return b - a | ||
c in a..b -> return b - c | ||
d in a..b -> return d - a | ||
else -> return -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.
Обратите внимание, что тесты для данной функции не проходят
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.
Проходит, у меня нигде нет сообщения об ошибке. Там два коммита почти сразу было, в первом не правильно, во втором все прошло.
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.
Да, прошу прощения, не заметил второго коммита
src/lesson2/task2/Logical.kt
Outdated
* Вернуть true, если кирпич пройдёт | ||
*/ | ||
fun brickPasses(a: Int, b: Int, c: Int, r: Int, s: Int): Boolean = TODO() | ||
fun brickPasses(a: Int, b: Int, c: Int, r: Int, s: Int): Boolean = ((((a <= r) && (b <= s)) || ((a <= s) && (b <= r))) || (((a <= r) && (c <= s)) || ((a <= s) && (c <= r))) || (((b <= r) && (c <= s)) || ((b <= s) && (c <= r)))) |
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.
Такой код лучше форматировать как
a && b
|| c && d
|| e && f
|| ...
src/lesson3/task1/Loop.kt
Outdated
return n | ||
} | ||
|
||
fun NOD(x: Int, y: Int): Int { |
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.
- Функции в Котлине принято называть
camelCase
- Данную функцию лучше назвать
gcd
src/lesson3/task1/Loop.kt
Outdated
var f1 = 1 | ||
var f2 = 0 | ||
var result = 1 | ||
if (n < 3) return result |
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.
Сколько раз будет выполнено тело цикла ниже, если n < 3
? Имеет ли смысл данная проверка?
src/lesson3/task1/Loop.kt
Outdated
*/ | ||
fun maxDivisor(n: Int): Int = TODO() | ||
fun maxDivisor(n: Int): Int { | ||
var res = 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.
Если мы ищем делители числа n
, не равные n
, какое максимальное значение может принимать любой другой делитель?
src/lesson3/task1/Loop.kt
Outdated
sum = sum + digitNumber(square) | ||
} | ||
count = sum - n | ||
if (count != 0) { |
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.
Зачем эта проверка? Что сделает код ниже, если count == 0
?
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.
Ненужные действия - исправил. В последней задачи тоже надо исправить, но поздно сообразил (после того как уже запушил), не стал лишний раз коммит делать.
authorAlex [korneev.ry@yandex.ru] lesson1.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 10 / 12 Example: 4 / 4 Succeeded:
Seed: 1077813246755573219 lesson2.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 3 / 7 Example: 1 / 1 Succeeded:
Seed: 1077813246755573219 lesson2.task2Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 5 / 5 Example: 1 / 1 Succeeded:
Seed: 1077813246755573219 lesson3.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 15 / 18 Example: 4 / 4 Succeeded:
Seed: 1077813246755573219 ownerSeveNChaK [] |
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.
Все хорошо, за исключением нескольких замечаний
(a >= c) && (b <= d) -> return b - a | ||
c in a..b -> return b - c | ||
d in a..b -> return d - a | ||
else -> return -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.
Да, прошу прощения, не заметил второго коммита
src/lesson2/task2/Logical.kt
Outdated
x2: Double, y2: Double, r2: Double): Boolean = TODO() | ||
x2: Double, y2: Double, r2: Double): Boolean { | ||
val r = Math.sqrt(sqr(y1 - y2) + sqr(x1 - x2)) + r1 | ||
return (r <= r2) |
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.
Лишние скобки вокруг выражения
src/lesson2/task2/Logical.kt
Outdated
*/ | ||
fun brickPasses(a: Int, b: Int, c: Int, r: Int, s: Int): Boolean = TODO() | ||
fun brickPasses(a: Int, b: Int, c: Int, r: Int, s: Int): Boolean = | ||
((((a <= r) && (b <= s)) |
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.
Много лишних скобок, которые можно убрать, если вспомнить о приоритете операций в Котлине
src/lesson3/task1/Loop.kt
Outdated
* Например, 25 и 49 взаимно простые, а 6 и 8 -- нет. | ||
*/ | ||
fun isCoPrime(m: Int, n: Int): Boolean = TODO() | ||
fun isCoPrime(m: Int, n: Int): Boolean = (gcd(m, 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.
Лишние скобки
src/lesson3/task1/Loop.kt
Outdated
fun revert(n: Int): Int = TODO() | ||
fun revert(n: Int): Int { | ||
var k = pow(10, digitNumber(n) - 1) | ||
var revertNumber = 0 |
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.
Лучше revertedNumber
src/lesson3/task1/Loop.kt
Outdated
sum = sum + digitNumber(fibn) | ||
} | ||
count = sum - n | ||
if (count != 0) { |
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.
Нужна ли эта проверка?
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.
Да, я вчера заметил, исправлю
authorAlex [korneev.ry@yandex.ru] lesson2.task2Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 5 / 5 Example: 1 / 1 Succeeded:
Seed: 1912800749757994264 lesson3.task1Author: Alex [korneev.ry@yandex.ru] Owner: SeveNChaK [] Total: 15 / 18 Example: 4 / 4 Succeeded:
Seed: 1912800749757994264 ownerSeveNChaK [] |
Готов сдать полностью Lesson 4, как только мы закончим с этим пулл реквестом.27.10.2016, 17:59, "Marat Akhin" notifications@github.com:@ice-phoenix requested changes on this pull request. Все хорошо, за исключением нескольких замечаний In src/lesson2/task1/IfElse.kt:
Да, прошу прощения, не заметил второго коммита In src/lesson2/task2/Logical.kt:
Лишние скобки вокруг выражения In src/lesson2/task2/Logical.kt:
Много лишних скобок, которые можно убрать, если вспомнить о приоритете операций в Котлине In src/lesson3/task1/Loop.kt:
Лишние скобки In src/lesson3/task1/Loop.kt:
Лучше revertedNumber In src/lesson3/task1/Loop.kt:
Нужна ли эта проверка? —You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread. |
Все отлично, можете заливать 4 урок. Этот PR я закрываю, чтобы GitHub'у было попроще =) |
Ураа:)28.10.2016, 15:39, "Marat Akhin" notifications@github.com:Все отлично, можете заливать 4 урок. Этот PR я закрываю, чтобы GitHub'у было попроще =) —You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread. |
No description provided.