diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2023-10-19 13:07:47 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2023-10-19 13:07:47 +0200 |
commit | 8cebce442f6fe64aa09e4e74837a8e48b8215540 (patch) | |
tree | 6e6c8711eaa27fa85a141c91dd0e995e19db0e72 /šola/p1/vaje/2023-10-19/Roman.java | |
parent | studisfri (diff) | |
download | r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar.gz r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar.bz2 r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar.lz r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar.xz r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar.zst r-8cebce442f6fe64aa09e4e74837a8e48b8215540.zip |
Diffstat (limited to '')
-rw-r--r-- | šola/p1/vaje/2023-10-19/Roman.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/šola/p1/vaje/2023-10-19/Roman.java b/šola/p1/vaje/2023-10-19/Roman.java new file mode 100644 index 0000000..d44f633 --- /dev/null +++ b/šola/p1/vaje/2023-10-19/Roman.java @@ -0,0 +1,15 @@ +import java.util.*; +public class Roman { + public static void main (String[] args) { + Scanner sc = new Scanner(System.in); + int p = sc.nextInt(); + int d = sc.nextInt(); + int z = sc.nextInt(); + int dan = 0; + while (p > 0 && d > 0) { + System.out.println(++dan + ": " + p + " -> " + (p-d > 0 ? p-d : 0)); + p -= d; + d -= z; + } + } +} |