This repository was archived by the owner on Sep 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
Задачи #202
Closed
Closed
Задачи #202
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
e0752a2
Решена задача №1
4938b29
Решена последняя тривиальная
5ec600a
Решена простая №1
1a83139
Решена последняя простая
5872d24
programm is great!
f315674
easy programm (2)
dmitrirazumov 5bb67c8
easy programm (3)
dmitrirazumov ac7a19c
easy programm (4)
dmitrirazumov e169a21
programm normal level
dmitrirazumov 551ec7d
programm normal level
dmitrirazumov 7146849
circleInside
dmitrirazumov 1946f98
lcm (lesson 3)
dmitrirazumov cef8354
revert (lesson 3)
dmitrirazumov 094d72d
2 programms from 4 lesson
dmitrirazumov bdc7f2d
5 programms from 4 lesson
dmitrirazumov 63f0c6c
5 programms from 4 lesson
dmitrirazumov 0137223
5 programms from 4 lesson
dmitrirazumov f185a38
1 programms from 4 lesson
dmitrirazumov bfa5004
1 programms from 4 lesson
dmitrirazumov 4ec65fc
2 programms from 5 lesson
dmitrirazumov cc953c9
1 programm from 6 lesson
dmitrirazumov cda72ec
normal and hard programms from 5 lesson
dmitrirazumov 7684804
hard programm from 5 lesson
dmitrirazumov 4c905e2
Добавил дополнительное условие в программу
dmitrirazumov 3919394
Добавил дополнительное условие в программу
dmitrirazumov e2c92ec
Добавил дополнительное условие в программу
dmitrirazumov fedf87d
Добавил дополнительное условие в программу
dmitrirazumov 28484f4
Добавил дополнительное условие в программу
dmitrirazumov 09feb7d
Добавил дополнительное условие в программу
dmitrirazumov e27cc4a
Добавил дополнительное условие в программу
dmitrirazumov fb33b6b
Добавил дополнительное условие в программу
dmitrirazumov e7864b3
Добавил дополнительное условие в программу
dmitrirazumov f370249
Добавил дополнительное условие в программу
dmitrirazumov 15e14a7
Добавил дополнительное условие в программу
dmitrirazumov 26a1e51
Добавил дополнительное условие в программу
dmitrirazumov 47e75cc
Добавил дополнительное условие в программу
dmitrirazumov 17fff95
Добавил дополнительное условие в программу
dmitrirazumov 0279715
Добавил дополнительное условие в программу
dmitrirazumov 485831d
Добавил дополнительное условие в программу
dmitrirazumov c987f8c
2 programms from 4 lesson
dmitrirazumov a6cff94
Проверка правильности программы через бота
dmitrirazumov d857d89
Проверка правильности программы через бота
dmitrirazumov 45b632b
Проверка правильности программы через бота
dmitrirazumov a7dabd9
Проверка правильности программы через бота
dmitrirazumov 50d1b00
Проверка правильности программы через бота
dmitrirazumov 0734c64
Проверка правильности программы через бота
dmitrirazumov 4063b84
Проверка правильности программы через бота
dmitrirazumov 06adeca
Проверка правильности программы через бота
dmitrirazumov 65bed38
Выяснение причины "Failure: Check Ended"
dmitrirazumov 1bf695a
Исправление замечаний
dmitrirazumov 29385f7
Пытка программы "PlusMinus"
dmitrirazumov a996930
Пытка программы "PlusMinus"
dmitrirazumov 565d992
Исправление всех ошибок
dmitrirazumov 387aa45
Most Expensive + one program from 6 lesson (task 1)
dmitrirazumov 674b648
//
dmitrirazumov f337428
//
dmitrirazumov 964a4d1
//
dmitrirazumov a56a5c3
Program from 6 lesson.
dmitrirazumov 378a9e0
Lesson 7:
dmitrirazumov a589456
Style correction
dmitrirazumov e5f0aff
Correction
dmitrirazumov 4948394
Add "hashCode()"
dmitrirazumov b36b1d6
Add "hashCode()"
dmitrirazumov 7ce3798
Correcting"hashCode()"
dmitrirazumov a54e397
Correcting "plusMinus"
dmitrirazumov 83a2d1b
Correcting "equals"
dmitrirazumov 8abcf9a
Correcting "equals"
dmitrirazumov 868bcfe
Correcting "equals"
dmitrirazumov 574034b
Correcting "equals"
dmitrirazumov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
@file:Suppress("UNUSED_PARAMETER") | ||
|
||
package lesson3.task1 | ||
|
||
/** | ||
|
@@ -34,7 +35,7 @@ fun isPrime(n: Int): Boolean { | |
*/ | ||
fun isPerfect(n: Int): Boolean { | ||
var sum = 1 | ||
for (m in 2..n/2) { | ||
for (m in 2..n / 2) { | ||
if (n % m > 0) continue | ||
sum += m | ||
if (sum > n) break | ||
|
@@ -57,7 +58,18 @@ fun digitCountInNumber(n: Int, m: Int): Int = | |
* Найти количество цифр в заданном числе n. | ||
* Например, число 1 содержит 1 цифру, 456 -- 3 цифры, 65536 -- 5 цифр. | ||
*/ | ||
fun digitNumber(n: Int): Int = TODO() | ||
fun digitNumber(n: Int): Int { | ||
if (n == 0) return 1 | ||
else { | ||
var number = Math.abs(n) | ||
var result = 0 | ||
while (number > 0) { | ||
number /= 10 | ||
result += 1 | ||
} | ||
return result | ||
} | ||
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. Может исправите эту задачу наконец? Она работает неверно для отрицательных чисел |
||
} | ||
|
||
/** | ||
* Простая | ||
|
@@ -73,7 +85,19 @@ fun fib(n: Int): Int = TODO() | |
* Для заданных чисел m и n найти наименьшее общее кратное, то есть, | ||
* минимальное число k, которое делится и на m и на n без остатка | ||
*/ | ||
fun lcm(m: Int, n: Int): Int = TODO() | ||
fun lcm(m: Int, n: Int): Int { | ||
var num_m = m | ||
var num_n = n | ||
val multiplication = (num_m * num_n) | ||
while ((num_m != 0) && (num_n != 0)) { | ||
if (num_m > num_n) num_m %= num_n | ||
else num_n %= num_m | ||
} | ||
val count = num_m + num_n | ||
return multiplication / count | ||
|
||
|
||
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. Пробелы, ненужные пустые строки |
||
} | ||
|
||
/** | ||
* Простая | ||
|
@@ -131,7 +155,15 @@ fun cos(x: Double, eps: Double): Double = TODO() | |
* Поменять порядок цифр заданного числа n на обратный: 13478 -> 87431. | ||
* Не использовать строки при решении задачи. | ||
*/ | ||
fun revert(n: Int): Int = TODO() | ||
fun revert(n: Int): Int { | ||
var m = 0 | ||
var num = n | ||
do { | ||
m = (m * 10 + (num % 10)) | ||
num /= 10 | ||
} while (num > 0) | ||
return m | ||
} | ||
|
||
/** | ||
* Средняя | ||
|
@@ -167,3 +199,5 @@ fun squareSequenceDigit(n: Int): Int = TODO() | |
* Например, 2-я цифра равна 1, 9-я 2, 14-я 5. | ||
*/ | ||
fun fibSequenceDigit(n: Int): Int = TODO() | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Здесь и далее, лучше использовать
&&
вместоand
,||
вместоor
.