--- title: "05-钞票" created: 2025-12-02 tags: - 项目 aliases: - 钞票 --- # 钞票 ## 题目 [钞票](https://www.acwing.com/problem/content/655/) ![[image-9a136d8b.png]] ## 思路分析 ## 代码实现 ```java import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int total=sc.nextInt(); System.out.println(total); System.out.printf("%d nota(s) de R$ 100,00\n",total/100); total -= total/100 * 100; System.out.printf("%d nota(s) de R$ 50,00\n",total/50); total -= total/50 * 50; System.out.printf("%d nota(s) de R$ 20,00\n",total/20); total -= total/20 * 20; System.out.printf("%d nota(s) de R$ 10,00\n",total/10); total -= total/10 * 10; System.out.printf("%d nota(s) de R$ 5,00\n",total/5); total -= total/5 * 5; System.out.printf("%d nota(s) de R$ 2,00\n",total/2); total -= total/2 * 2; System.out.printf("%d nota(s) de R$ 1,00\n",total); } } ``` ```java import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int total=sc.nextInt(); int[] money=new int[]{100,50,20,10,5,2,1}; System.out.println(total); for(int x:money){ System.out.printf("%d nota(s) de R$ %d,00\n",total/x,x); total%=x; } } } ``` ## 同类题型 ## 视频讲解 --- **项目分区导航**: [[04-时间转换|时间转换]] ⬅️ | 05-钞票 | ➡️ [[00-判断语句|判断语句]]