문서 편집 권한이 없습니다. 다음 이유를 확인해주세요: 요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다: 사용자. 문서의 원본을 보거나 복사할 수 있습니다. ==개요== ;<nowiki>Day 2: Operators</nowiki> * https://www.hackerrank.com/challenges/30-operators/problem {{HR30 헤더}} {{HR30 0-9}} |} ==Java== <syntaxhighlight lang='java'> import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { static void solve(double meal_cost, int tip_percent, int tax_percent) { double tip = meal_cost * tip_percent / 100; double tax = meal_cost * tax_percent / 100; long total_cost = Math.round(meal_cost + tip + tax); System.out.format("The total meal cost is %d dollars.", total_cost); } private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { double meal_cost = scanner.nextDouble(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); int tip_percent = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); int tax_percent = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); solve(meal_cost, tip_percent, tax_percent); scanner.close(); } } </syntaxhighlight> ==PHP== <syntaxhighlight lang='php'> <?php function solve($meal_cost, $tip_percent, $tax_percent) { $tip = $meal_cost * $tip_percent / 100; $tax = $meal_cost * $tax_percent / 100; $total_cost = round($meal_cost + $tip + $tax); echo "The total meal cost is $total_cost dollars."; } $stdin = fopen("php://stdin", "r"); fscanf($stdin, "%lf\n", $meal_cost); fscanf($stdin, "%d\n", $tip_percent); fscanf($stdin, "%d\n", $tax_percent); fclose($stdin); solve($meal_cost, $tip_percent, $tax_percent); </syntaxhighlight> <syntaxhighlight lang='php'> <?php function solve($meal_cost, $tip_percent, $tax_percent) { $tip = $meal_cost * $tip_percent / 100; $tax = $meal_cost * $tax_percent / 100; return round($meal_cost + $tip + $tax); } $stdin = fopen("php://stdin", "r"); fscanf($stdin, "%lf\n", $meal_cost); fscanf($stdin, "%d\n", $tip_percent); fscanf($stdin, "%d\n", $tax_percent); fclose($stdin); $total_cost = solve($meal_cost, $tip_percent, $tax_percent); echo "The total meal cost is $total_cost dollars."; </syntaxhighlight> ==Python== <syntaxhighlight lang='python'> #!/bin/python3 import math import os import random import re import sys # Complete the solve function below. def solve(meal_cost, tip_percent, tax_percent): tip = meal_cost * tip_percent / 100; tax = meal_cost * tax_percent / 100; total_cost = round(meal_cost + tip + tax) print( 'The total meal cost is '+str(total_cost)+' dollars.') if __name__ == '__main__': meal_cost = float(input()) tip_percent = int(input()) tax_percent = int(input()) solve(meal_cost, tip_percent, tax_percent) </syntaxhighlight> 이 문서에서 사용한 틀: 틀:Ed (원본 보기) 틀:HR30 0-9 (원본 보기) 틀:HR30 헤더 (원본 보기) 틀:언어아이콘 (원본 보기) 틀:언어이미지 (원본 보기) HR30 Day 2: Operators 문서로 돌아갑니다.