Menu
CoddyTech

복습: 소포 송장

Coddy의 JavaScript 개발자를 위한 Dart 코스 레슨. 48개 중 6번째.

challenge icon

챌린지

쉬움

invoice(int count, int price, int fee)를 구현하세요. count와 price를 곱한 값에 fee를 더해 반환합니다. 0 이상 1000 이하인 정수 3개가 입력으로 주어집니다. count가 0이어도 fee는 부과됩니다.

편집 가능한 파일에서 출력하지 마세요. 제공된 exercise.dart가 입력을 파싱하고 출력을 반환하며, 잠긴 드라이버가 공개 API를 별도로 테스트하고 결과를 줄바꿈 문자 하나와 함께 출력합니다.

코드는 functions.dart, exercise.dart에 작성하세요. main.dart에는 제공된 입력/출력 코드가 있으며 편집할 수 없습니다.

직접 해보기

import 'dart:io';
import 'dart:convert';
import 'exercise.dart';
import 'functions.dart';
void check(bool condition){if(!condition)throw StateError('Public API contract failed');}
Future<void> main() async {
final raw=await stdin.transform(utf8.decoder).join();
final input=raw.replaceFirst(RegExp(r'\r?\n$'),'');
check(invoice(3,4,2)==14);
stdout.writeln(solve(input));
}

JavaScript 개발자를 위한 Dart의 모든 레슨

직접 연습해 보세요: 온라인 Dart 컴파일러