Skip to content
This repository was archived by the owner on Sep 6, 2018. It is now read-only.

Conversation

RainbowDev
Copy link

No description provided.

@ice-phoenix ice-phoenix self-assigned this Sep 14, 2016
* Человек положил в банк сумму в s рублей под p% годовых (проценты начисляются в конце года).
* Сколько денег будет на счету через 3 года (с учётом сложных процентов)?
* Например, 100 рублей под 10% годовых превратятся в 133.1 рубля
* Например, 100 рублей под 10% годовых превратятся в 133.1 рубл
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В коммитах лучше избегать изменений, не относящихся к решаемой задаче.

@ice-phoenix
Copy link
Contributor

Название PR кек не соответствует его содержанию. В будущем настоятельно рекомендуется давать PR названия, позволяющие понять, что было сделано в данном PR.

@mglukhikh
Copy link
Contributor

Автору PR: вы уже довольно сильно отстаёте от графика. Вам следует исправить замечания в этом PR и перейти к решению задач из 2-го и 3-го урока, в противном случае вы рискуете получить неудовлетворительную оценку за октябрь.

@mglukhikh mglukhikh removed the stale label Oct 19, 2016
@ice-phoenix
Copy link
Contributor

Название пулл реквеста все еще не соответствует его содержанию. Если вы его не поправите к концу октября, вместо зачета по предмету вы получите парочку мемосов и представление к отчислению.

Copy link
Contributor

@ice-phoenix ice-phoenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ваши следующие задачи не будут проверяться до тех пор, пока вы не исправите все имеющиеся замечания к урокам 1-3.

fun ageDescription(age: Int): String {
var sAge = "$age"
val ageL=age%10
if (age%100 in 10..20) sAge+=" лет"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Все это выражение лучше оформить как один плоский when

*/
fun ageDescription(age: Int): String = TODO()
fun ageDescription(age: Int): String {
var sAge = "$age"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вместо отдельной переменной лучше возвращать результаты работы вашей функции прямо по месту в виде "$age лет"

rookX2: Int, rookY2: Int): Int = TODO()
rookX2: Int, rookY2: Int): Int {
val threat: Int
if ((kingX == rookX1 && rookX2 == kingX) || (kingY == rookY1 && rookY2 == kingY) || (kingY == rookY1 && rookX2 == kingX) || (kingX == rookX1 && rookY2 == kingY)) threat = 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Выражения, отвечающие за факт атаки короля той или иной ладьей, следует вынести в отдельные переменные

bishopX: Int, bishopY: Int): Int = TODO()
bishopX: Int, bishopY: Int): Int {
val threat:Int
if ((Math.abs(bishopX-kingX)==Math.abs(bishopY-kingY)) && (rookX==kingX || rookY==kingY)) threat=3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Выражения, отвечающие за факт атаки короля ладьей или слоном, следует вынести в отдельные переменные

fun triangleKind(a: Double, b: Double, c: Double): Int = TODO()
fun triangleKind(a: Double, b: Double, c: Double): Int {
val kind:Int
if (a+b<c || c+a<b || b+c<a) kind=-1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше сперва найти максимальную сторону, а потом все один раз посчитать относительно нее

fun revert(n: Int): Int {
if (n<10) return n
var nn=n
var result:Int=0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Система типов Котлина выведет тип переменной автоматически

var nn=n
var result:Int=0
var ext:Int=1
var count=0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет ли у вас готовой функции, которая считает количество цифр в числе?

}
nn=n
for (i in count downTo 1){
for (j in 1..i-1) {ext*=10}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Напишите функцию fun pow(Int, Int): Int

nn/=10
ext=1
}
return result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пожалуйста, форматируйте ваш код так, как будто его будет читать психопат-перфекционист с педантичной любовью к каждому пробелу и каждому переносу строки, у которого есть топор и который знает, где вы живете

else return true
nn/=10
}
if (test==1) return false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В каком случае вы можете оказаться здесь, а переменная test не равна 1???

@RainbowDev RainbowDev changed the title кек Lessons 1-3 Копылов М. Oct 20, 2016
@RainbowDev
Copy link
Author

А можно мне просто мемосов без отчисления? :D
В ближайшее время постараюсь исправить все замечания

@RainbowDev
Copy link
Author

Второй "Исправленный Lesson 2 Task 1" - это "Исправленный Lesson 3", когда коммитил забыл переименовать

* Например, расстояние между (3, 0) и (0, 4) равно 5
*/
fun trackLength(x1: Double, y1: Double, x2: Double, y2: Double): Double = TODO()
fun trackLength(x1: Double, y1: Double, x2: Double, y2: Double): Double = sqrt(sqr(abs(x1 - x2)) + sqr(abs(y1 - y2)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем брать модуль перед возведением числа в квадрат?

* Определите время поезда в пути в минутах (в данном случае 216).
*/
fun travelMinutes(hoursDepart: Int, minutesDepart: Int, hoursArrive: Int, minutesArrive: Int): Int = TODO()
fun travelMinutes(hoursDepart: Int, minutesDepart: Int, hoursArrive: Int, minutesArrive: Int): Int = (minutesArrive - minutesDepart) + 60 * (hoursArrive - hoursDepart)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Длинные строки принято разбивать на несколько более коротких, в данном случае, например, после знака = в объявлении функции

fun accountInThreeYears(initial: Int, percent: Int): Double = TODO()

fun accountInThreeYears(initial: Int, percent: Int): Double {
val perc = percent.toDouble() / 100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вместо явного вызова toDouble() при floating-point операциях, включающих константы, обычно эти самые константы делают типа Double --- percent / 100.0

fun accountInThreeYears(initial: Int, percent: Int): Double {
val perc = percent.toDouble() / 100
val inperc = perc * initial
return initial + inperc + (initial + inperc) * perc + (initial + inperc + (initial + inperc) * perc) * perc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Формулу можно упростить, если воспользоваться математическими правилами

*/
fun numberRevert(number: Int): Int = TODO()
fun numberRevert(number: Int): Int {
val n1:Int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему вы разделили определение и объявление переменной?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Все еще актуально

fun squareBetweenExists(m: Int, n: Int): Boolean = TODO()
fun squareBetweenExists(m: Int, n: Int): Boolean {
val sqroot = Math.sqrt(m.toDouble()).toInt()
return (sqroot * sqroot >= m && sqroot * sqroot <= n) || ((sqroot + 1) * (sqroot + 1) <= n)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если вы примените правильную функцию округления, данную проверку можно будет упростить

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Все еще актуально

fun revert(n: Int): Int {
if (n < 10) return n
var nn = n
var result: Int = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Система типов Котлина выведет тип переменной автоматически

if (n < 10) return n
var nn = n
var result: Int = 0
var ext: Int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему эта переменная объявлена здесь, а не ниже прямо при использовании?

val count = digitNumber(n)

for (i in count downTo 1) {
ext = pow(10, i - 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно ли перестроить ваш алгоритм так, чтобы не было необходимости на каждой итерации цикла возводить 10 в требуемую степень?

fun hasDifferentDigits(n: Int): Boolean = TODO()
fun hasDifferentDigits(n: Int): Boolean {
if (n < 10) return false
val samenum: Int = n % 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Переменным лучше давать осмысленные имена, соответствующие их назначению в коде
  • Система типов Котлина выведет тип переменной автоматически

@RainbowDev RainbowDev changed the title Lessons 1-3 Копылов М. Lessons 1-4 Копылов М. Oct 26, 2016
@ice-phoenix
Copy link
Contributor

4 урок будет проверен после того, как вы исправите замечания к предыдущим урокам

@mglukhikh
Copy link
Contributor

Вы довольно сильно отстаёте от графика. Вам следует продолжать решать задачи учебного проекта.

@ice-phoenix ice-phoenix removed the stale label Nov 25, 2016
fun accountInThreeYears(initial: Int, percent: Int): Double {
val perc = percent / 100.0
val inperc = perc * initial
return initial + inperc + (initial + inperc) * perc + (initial + inperc + (initial + inperc) * perc) * perc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Данное выражение можно очень сильно упростить, если вспомнить о некоторых математических свойствах умножения и сложения

*/
fun numberRevert(number: Int): Int = TODO()
fun numberRevert(number: Int): Int {
val n1:Int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Все еще актуально

val r1Threat = (kingX == rookX1) || (kingY == rookY1)
val r2Threat = (kingX == rookX2) || (kingY == rookY2)

if (r1Threat && r2Threat) return 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Все еще актуально

val rThreat: Boolean = (kingX == rookX) || (kingY == rookY)
val bThreat: Boolean = Math.abs(bishopX - kingX) == Math.abs(bishopY - kingY)

if ((bThreat) && (rThreat)) return 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Все еще актуально

val side1: Double
val side2: Double

if (a > b && a>c) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Форматирование кода

for (i in list.size - 1 downTo 1) {
for (j in i downTo 1) {
list[i] += list[j - 1]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Подумайте, нужен ли вообще этот цикл?

nn /= base
}
list.reverse()
return list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше как list.reversed()

*/
fun convertToString(n: Int, base: Int): String = TODO()
fun convertToString(n: Int, base: Int): String {
var result: String = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Во первых, можно не указывать тип. Во вторых, для подобных операций лучше использовать список строк или StringBuilder.

var result: String = ""
val list = convert(n, base)
for (element in list){
if (element > 9) result += ('a'.toInt() + element - 10).toChar()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем toInt()?

fun decimal(digits: List<Int>, base: Int): Int {
var result = 0
var iDigit = 1
for (i in digits.size-1 downTo 0){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Форматирование кода

@RainbowDev RainbowDev changed the title Lessons 1-4 Копылов М. Lessons 1-5 Копылов М. Dec 13, 2016
@ice-phoenix
Copy link
Contributor

Довольно много замечаний еще не исправлены. Новые уроки не будут проверены, пока вы не исправите предыдущие.

@ice-phoenix ice-phoenix removed the stale label Dec 14, 2016
@ice-phoenix
Copy link
Contributor

recheck all

@kotlin-polytech-bot
Copy link

author

RainbowDev [diablo3355@gmail.com]

lesson1.task1

Author: RainbowDev [diablo3355@gmail.com]

Owner: RainbowDev []

Total: 12 / 12

Example: 4 / 4
Trivial: 4 / 4
Easy: 4 / 4

Succeeded:

  • [Trivial] lesson1.task1/trackLength
  • [Trivial] lesson1.task1/seconds
  • [Example] lesson1.task1/discriminant
  • [Example] lesson1.task1/sqr
  • [Example] lesson1.task1/sqRoot
  • [Trivial] lesson1.task1/lengthInMeters
  • [Easy] lesson1.task1/travelMinutes
  • [Trivial] lesson1.task1/angleInRadian
  • [Easy] lesson1.task1/thirdDigit
  • [Example] lesson1.task1/quadraticRootProduct
  • [Easy] lesson1.task1/accountInThreeYears
  • [Easy] lesson1.task1/numberRevert

Seed: -8748346597584261012

lesson2.task1

Author: RainbowDev [diablo3355@gmail.com]

Owner: RainbowDev []

Total: 5 / 7

Example: 1 / 1
Easy: 4 / 5
Normal: 0 / 1

Succeeded:

  • [Example] lesson2.task1/minBiRoot
  • [Easy] lesson2.task1/ageDescription
  • [Easy] lesson2.task1/whichRookThreatens
  • [Easy] lesson2.task1/rookOrBishopThreatens
  • [Easy] lesson2.task1/triangleKind

Seed: -8748346597584261012

lesson2.task2

Author: RainbowDev [diablo3355@gmail.com]

Owner: RainbowDev []

Total: 3 / 5

Example: 1 / 1
Easy: 1 / 2
Normal: 1 / 2

Succeeded:

  • [Normal] lesson2.task2/brickPasses
  • [Example] lesson2.task2/pointInsideCircle
  • [Easy] lesson2.task2/isNumberHappy

Failed:

  • [Easy] lesson2.task2/queenThreatens
    • Expected:
      false
      
    • Actual:
      true
      
    • Inputs:
      • x1 ->
        1
        
      • y1 ->
        3
        
      • x2 ->
        8
        
      • y2 ->
        6
        
    • Exception: null

Seed: -8748346597584261012

lesson3.task1

Author: RainbowDev [diablo3355@gmail.com]

Owner: RainbowDev []

Total: 12 / 18

Example: 4 / 4
Trivial: 1 / 1
Easy: 5 / 8
Normal: 2 / 3
Hard: 0 / 2

Succeeded:

  • [Example] lesson3.task1/factorial
  • [Example] lesson3.task1/isPrime
  • [Example] lesson3.task1/isPerfect
  • [Example] lesson3.task1/digitCountInNumber
  • [Trivial] lesson3.task1/digitNumber
  • [Easy] lesson3.task1/fib
  • [Easy] lesson3.task1/minDivisor
  • [Easy] lesson3.task1/maxDivisor
  • [Easy] lesson3.task1/isCoPrime
  • [Easy] lesson3.task1/squareBetweenExists
  • [Normal] lesson3.task1/revert
  • [Normal] lesson3.task1/hasDifferentDigits

Failed:

  • [Easy] lesson3.task1/lcm
    • Expected:
      182305668
      
    • Actual:
      91152834
      
    • Inputs:
      • m ->
        4371
        
      • n ->
        41708
        
    • Exception: null

Seed: -8748346597584261012

lesson4.task1

Author: RainbowDev [diablo3355@gmail.com]

Owner: RainbowDev []

Total: 16 / 21

Example: 7 / 7
Easy: 2 / 2
Normal: 6 / 7
Hard: 1 / 4
Impossible: 0 / 1

Succeeded:

  • [Example] lesson4.task1/sqRoots
  • [Example] lesson4.task1/squares
  • [Example] lesson4.task1/biRoots
  • [Example] lesson4.task1/isPalindrome
  • [Example] lesson4.task1/negativeList
  • [Easy] lesson4.task1/mean
  • [Example] lesson4.task1/buildSumExample
  • [Example] lesson4.task1/invertPositives
  • [Normal] lesson4.task1/center
  • [Normal] lesson4.task1/times
  • [Normal] lesson4.task1/polynom
  • [Normal] lesson4.task1/accumulate
  • [Normal] lesson4.task1/factorize
  • [Hard] lesson4.task1/factorizeToString
  • [Normal] lesson4.task1/decimal
  • [Easy] lesson4.task1/abs

Failed:

  • [Normal] lesson4.task1/convert
    • Expected:
      [0]
      
    • Actual:
      []
      
    • Inputs:
      • n ->
        0
        
      • base ->
        19
        
    • Exception: null
  • [Hard] lesson4.task1/convertToString
    • Expected:
      0
      
    • Actual:
      
      
    • Inputs:
      • n ->
        0
        
      • base ->
        34
        
    • Exception: null

Seed: -8748346597584261012

lesson5.task1

Author: RainbowDev [diablo3355@gmail.com]

Owner: RainbowDev []

Total: 4 / 12

Example: 2 / 2
Normal: 1 / 3
Hard: 1 / 7

Succeeded:

  • [Example] lesson5.task1/timeStrToSeconds
  • [Example] lesson5.task1/timeSecondsToStr
  • [Normal] lesson5.task1/dateDigitToStr
  • [Hard] lesson5.task1/firstDuplicateIndex

Failed:

  • [Normal] lesson5.task1/dateStrToDigit
    • java.lang.IndexOutOfBoundsException : Index: 1, Size: 1
  • [Normal] lesson5.task1/dateStrToDigit
    • Expected:
      
      
    • Actual:
      null
      
    • Inputs:
      • str ->
        彍듥뫋퇮렃㱦븉ɿ퓳ؿꀺǿ찱҃ꪼ燃뮷ガ瞨?瞭횉Ꮔ壪᩷?볏⻏烪?黡
        
    • Exception: java.lang.NumberFormatException: For input string: "彍듥뫋퇮렃㱦븉ɿ퓳ؿꀺǿ찱҃ꪼ燃뮷ガ瞨?瞭횉Ꮔ壪᩷?볏⻏烪?黡"
  • [Normal] lesson5.task1/bestLongJump
    • Expected:
      2147483647
      
    • Actual:
      -1
      
    • Inputs:
      • jumps ->
        % 2054372779   2147483647 -   - 2010376989  % % % 1762818165 2147483647 -  629382481  - % -  2147483647 0 - - 418121871 0 -  -   2147483647  -   794731899 0  -  - %    - 1 1399539462 % 0   % - -  - % 2147483647 512728608 -  -  2147483647  1  -    %   2147483647 -  1  - -  2147483647     2096199414  -    0  -  %  0 2147483647 497937687  - 1694260298 - - -  2147483647 -  937230924 - - % 2147483647 % - - - 505997719 % %
        
    • Exception: null
  • [Hard] lesson5.task1/mostExpensive
    • Expected:
      0.0
      
    • Actual:
      null
      
    • Inputs:
      • description ->
        轻멬۬ψ久モቈ춞耍΢⿰?萯멕忝籺塤ꕇ圪ͳ沫࣫產笪멬할棰䵸쒅ᨰ㵊ὶ�攌坵및Ⓟϳ탂?䯦굾㡊휍려殸ᜨ뤼ⷠ䤫?嶃㸅곆寧隌鯙幋ἶ៧蔦읍醅ꭸ掑욡ꬨ?ꞏꑾ⡣἗霁扱﫢喎䊺綽叾쎬嘑⛂㭨襰濎ଳ卓몯䶖?諔丅㋰퇂䚝?๑㒤䛤飁돋稪錡甬㜛諆酘訥깇⢛【挳줅嵎࣯疵览⼨嶔᛻⸺푋ﺍ깡膹፤䅍阋믙凜㢙⇙皉㘜䓢၅᭕ⷮꕻﻦ瑏禳ퟲЗ㼥ᐅ萹霔慍퐠씆썲깟៳걧삺앓鑞븞遼텄ᩭ켏◺嵃绌 0
        
    • Exception: null

Seed: -8748346597584261012

owner

RainbowDev []

total

Author: RainbowDev [diablo3355@gmail.com]

Owner: RainbowDev []

Total: 61 / 136

Example: 28 / 30
Trivial: 5 / 6
Easy: 16 / 29
Normal: 10 / 38
Hard: 2 / 26
Impossible: 0 / 7

@ice-phoenix
Copy link
Contributor

Поздравляем, у вас зачет! До встречи на экзамене!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants