|
|
вернуться в форумTime limit! please help import java.util.Scanner; public class Computers { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = 0; int com = in.nextInt(); int mod = in.nextInt();
if (mod == 1 && com == 1 ){ System.out.println(mod); return; }
for(int x = 1;x < com;){ if (x == 1){ x++; a++; } if (x - mod == 0 && com - x > mod){ x+=mod; a++; }else if (x - mod == 0 && com - x < mod){ x+= com - x; a++; } if (x < mod && com - x > mod){ x+=x; a++; }else if (x < mod && com - x < mod){ x+= com - x; a++; } if (x > mod && com - x > mod){ x+=mod; a++; }else if (x > mod && com - x < mod){ x+= com - x; a++; }
} System.out.println(a); } } |
|
|