UVA 10170 Java

  1. import java.util.*;
  2. import static java.lang.System.*;
  3. public class main{
  4. public static void main(String[] args) {
  5. Scanner sc=new Scanner(System.in);
  6. while(sc.hasNextInt())
  7. {
  8. long p = sc.nextLong();
  9. long d = sc.nextLong();
  10. long s = p;
  11. while(s < d)
  12. s += ++p;
  13. System.out.println(p);
  14. }
  15. }
  16. };
  17.  

留言

這個網誌中的熱門文章

C# 井字遊戲