Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Solution {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- long n = in.nextInt();
- long c = in.nextInt();
- long u = in.nextInt();
- long s = in.nextInt();
- long n2 = n;
- long c2 = c;
- long max, count3;
- long count1 = c/u;
- // int i = 0;
- // while(u*n > c){
- // n--;
- // c+=s;
- // long x = c/u;
- // if(n<c) {
- // break;
- // }
- // }
- n2 = n-count1;
- long remainingC = c%u;
- long upgradabel = 0;
- do{
- while(remainingC<u){
- n2--;
- remainingC+=s;
- }
- count1++;
- System.out.println(count1);
- remainingC-=u;
- if(u>remainingC) break;
- if(n2<0) break;
- }while(true);
- long count2 = c2/u;
- count3 =count1 + count2;
- if(count3>n) max=count3;
- else max=n;
- System.out.println(count1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement