문서 편집 권한이 없습니다. 다음 이유를 확인해주세요: 요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다: 사용자. 문서의 원본을 보거나 복사할 수 있습니다. ==개요== HR30 Day 26: Nested Logic * https://www.hackerrank.com/challenges/30-nested-logic/problem {{HR30 헤더}} {{HR30 20-29}} |} ==Java== <syntaxhighlight lang='Java'> import java.io.*; import java.util.*; public class Solution { static int getFine(int actualDay, int actualMonth, int actualYear, int expectedDay, int expectedMonth, int expectedYear) { if(actualYear > expectedYear) return 10000; if(actualYear < expectedYear) return 0; if(actualMonth > expectedMonth) { return 500 * (actualMonth-expectedMonth); } if(actualMonth < expectedMonth) return 0; if(actualDay > expectedDay) { return 15 * (actualDay-expectedDay); } return 0; } public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); int actualDay = sc.nextInt(); int actualMonth = sc.nextInt(); int actualYear = sc.nextInt(); int expectedDay = sc.nextInt(); int expectedMonth = sc.nextInt(); int expectedYear = sc.nextInt(); int fine = getFine(actualDay, actualMonth, actualYear, expectedDay, expectedMonth, expectedYear); System.out.println(fine); } } </syntaxhighlight> ==PHP== <syntaxhighlight lang='PHP'> <?php function get_fine($actualDay, $actualMonth, $actualYear, $expectedDay, $expectedMonth, $expectedYear) { if($actualYear > $expectedYear) return 10000; if($actualYear < $expectedYear) return 0; if($actualMonth > $expectedMonth) { return 500*($actualMonth-$expectedMonth); } if($actualMonth < $expectedMonth) return 0; if($actualDay > $expectedDay) { return 15*($actualDay-$expectedDay); } return 0; } $_fp = fopen("php://stdin", "r"); /* Enter your code here. Read input from STDIN. Print output to STDOUT */ fscanf($_fp, '%d %d %d', $actualDay, $actualMonth, $actualYear); fscanf($_fp, '%d %d %d', $expectedDay, $expectedMonth, $expectedYear); $fine = get_fine($actualDay, $actualMonth, $actualYear, $expectedDay, $expectedMonth, $expectedYear); echo $fine; </syntaxhighlight> 이 문서에서 사용한 틀: 틀:Ed (원본 보기) 틀:HR30 20-29 (원본 보기) 틀:HR30 헤더 (원본 보기) 틀:언어아이콘 (원본 보기) 틀:언어이미지 (원본 보기) HR30 Day 26: Nested Logic 문서로 돌아갑니다.