【GUI程序设计】学生信息管理系统

  第12个java作业,断断续续的用闲散时间写了十多天才算完成,一共大概1470行,记得上学期的C++课程设计也是写了1400多行,写着写着就发现上了瘾,不是为了应付作业而写,而是想探索自己未知的知识领域。

前身是:学生信息排序管理(JAVA文件操作)   用图形界面进行了重构

继续阅读【GUI程序设计】学生信息管理系统

【BFS】营救天使

Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison. 

Angel’s friends want to save Angel. Their task is: approach Angel. We assume that “approach Angel” is to get to the position where Angel stays. When there’s a guard in the grid, we must kill him (or her?) to move into the grid. We assume that we moving up, down, right, left takes us 1 unit time, and killing a guard takes 1 unit time, too. And we are strong enough to kill all the guards. 

You have to calculate the minimal time to approach Angel. (We can move only UP, DOWN, LEFT and RIGHT, to the neighbor grid within bound, of course.) 

继续阅读【BFS】营救天使

【数学规律】A、 Frog Jumping

数学规律题: 题目链接

思路:分情况讨论,①跳奇数次s=(n-1)/2*(a-b)+a②跳偶数次s=(n)/2*(a-b)

注意:结果可能很大,用lld或者BigInteger解决

import java.math.BigInteger;
import java.util.Scanner;
import java.util.*;
import java.lang.*;
public class Main {
  
  public static void main(String[] args) {
    Scanner cin=new Scanner(System.in);
    int n=cin.nextInt();
    while(n--!=0)
    {
      int a=cin.nextInt(),b=cin.nextInt(),dis=a-b;
      BigInteger c=cin.nextBigInteger();
      if((c.mod(BigInteger.valueOf(2))).equals(BigInteger.ZERO))
      {
        c=c.divide(BigInteger.valueOf(2));
        System.out.println(c.multiply(BigInteger.valueOf(dis)));
      }
      
      else {
        c=c.subtract(BigInteger.ONE);
        c=c.divide(BigInteger.valueOf(2));
        c=c.multiply(BigInteger.valueOf(dis));
        System.out.println(c.add(BigInteger.valueOf(a)));
      }
      
    
    }
  
  }	
}