import java.util.Scanner; public class Demo { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int C1 = sc.nextInt(); int C5 = sc.nextInt(); int C10 = sc.nextInt(); int C50 = sc.nextInt(); int C100 = sc.nextInt(); int C500 = sc.nextInt(); int count = 0; int r = A; while(C500-- > 0 && r >= 500){ r -= 500; count++; } while(C100-- > 0 && r >= 100){ r -= 100; count++; } while(C50-- > 0 && r >= 50){ r -= 50; count++; } while(C10-- > 0 && r >= 10){ r -= 10; count++; } while(C5-- > 0 && r >= 5){ r -= 5; count++; } while(C1-- > 0 && r >= 1){ r -= 1; count++; } System.out.print(count); } }
为什么会报runtime error错误
按道理说一定有一个解的
卧龙绝圣
相关分类