This file contains 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
import java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scn = new Scanner(System.in); | |
int n = scn.nextInt(), tot = n / 100 * 20; | |
Boolean b = true; | |
if (n / 100 == 8) { | |
tot += n % 100 + 1; | |
} | |
n %= 100; | |
tot += n / 10; | |
if (n > 88 && n / 10 != 8) | |
b = false; | |
if (n >= 80 && n < 90) | |
tot += n - 79; | |
else if (n >= 90) | |
tot += 10; | |
if (n >= 98) | |
tot++; | |
n %= 10; | |
if (n >= 8 && n <= 9 && b) | |
tot++; | |
System.out.println(tot); | |
} | |
/*題目:C_MM261-易 數字的出現次數 | |
作者:1010 | |
時間:西元 2017 年 4 月*/ | |
} |
沒有留言:
張貼留言