HDOJ 1555 How many days?

来源:互联网 发布:hadoop tensorflow 编辑:程序博客网 时间:2024/05/16 11:56

HDACM 1555

水题

import java.util.Scanner;public class Main{    public static void main(String[] args) {        Scanner sc = new Scanner(System.in);        while (sc.hasNext()) {            int m = sc.nextInt();            int k = sc.nextInt();            if (m==0&&k==0) {                break;            }            int t = 0;            int i = 0;            while (m>0) {                t++;                i++;                m--;                if (i==k) {                    m++;                    i=0;                }            }            System.out.println(t);        }        sc.close();    }}
原创粉丝点击