Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/McNuggets-problem/Dart/mcnuggets-problem.dart
Normal file
12
Task/McNuggets-problem/Dart/mcnuggets-problem.dart
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import 'dart:math';
|
||||
main() {
|
||||
var nuggets = List<int>.generate(101, (int index) => index);
|
||||
for (int small in List<int>.generate((100 ~/ (6 + 1)), (int index) => index)) {
|
||||
for (int medium in List<int>.generate((100 ~/ (9 + 1)), (int index) => index)) {
|
||||
for (int large in List<int>.generate((100 ~/ (20 + 1)), (int index) => index)) {
|
||||
nuggets.removeWhere((element) => element == 6 * small + 9 * medium + 20 * large);
|
||||
}
|
||||
}
|
||||
}
|
||||
print('Largest non-McNuggets number: ${nuggets.reduce(max).toString() ?? 'none'}.');
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue