第一题AC,注意点:输入是long类型,不能用BufferedReader,不然很麻烦:

 1 public class Main {
 2 
 3     public static void main(String[] args) throws IOException {
 4         Scanner in = new Scanner(System.in);
 5         long x = in.nextLong();
 6         long f = in.nextLong();
 7         long d = in.nextLong();
 8         long p = in.nextLong();
 9         long last = d - x * f;
10         if(last > 0) {
11             long day = last / (x + p);
12             System.out.println(day + f);
13         }
14         //如果钱还不够付初始房费的
15         else {
16             long day = d / x;
17             System.out.println(day);
18         }
19     }
20 
21 }
View Code

相关文章:

  • 2021-06-07
  • 2021-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-12-04
  • 2021-12-02
  • 2021-04-06
猜你喜欢
  • 2022-12-23
  • 2021-10-11
  • 2021-09-17
  • 2021-12-17
  • 2022-01-15
  • 2021-09-22
相关资源
相似解决方案