• 算法训练(大富翁)


    题目:

    代码:

    import java.util.Scanner;

    public class DaFuWong {
    static int t = 0;
    static int to = 0;
    public static void main(String[] args) {
    int n=new Scanner(System.in).nextInt();

    int[] a = new int[n];
    fu(n);
    System.out.println(t);
    }

    private static void fu(int n) {
    for (int i = 1; i < 7; i++) {
    if(to<n){
    to += i;
    fu(n);
    to -= i;
    }else if(to>n){
    continue;
    }else{
    t++;
    return;
    }
    }
    }
    }

  • 相关阅读:
    hdu 3496
    poj 2374
    zoj 3399
    poj 1321
    sgu 365
    hdu 3555
    poj 3345
    poj 2355
    Android重命名文件
    在workflow中传值的sample
  • 原文地址:https://www.cnblogs.com/-rainbow-/p/7449488.html
Copyright © 2020-2023  润新知