zoukankan      html  css  js  c++  java
  • 四则运算

    public class sizeyunsuan {     public static void main(String[] args) {                 Random random = new Random();                 for (int j = 1; j <= 300; j++) {                     int algorithm = random.nextInt(4);                     int num1 = random.nextInt(100);                     int num2 = random.nextInt(100);
    switch (algorithm) { case 0:
                     System.out.println("第" + j + "个:");
    System.out.println(num1 + "*" + num2 + "=" ); break; case 1:
                     System.out.println("第" + j + "个:");
    System.out.println(num1 + "+" + num2 + "=" ); break; case 2:
                     System.out.println("第" + j + "个:");
    System.out.println(num1 + "-" + num2 + "=" ); break; case 3:
    if (num2 == 0) {
    j--; break; } else {
                        System.out.println("第" + j + "个:");
    System.out.println(num1 + "/" + num2 + "=");
    } break; default: break; } } }
    }
  • 相关阅读:
    poj 2488 A Knight's Journey( dfs )
    poj 2676 Sudoku ( dfs )
    poj 3087 Shuffle'm Up ( map 模拟 )
    poj 1426 Find The Multiple( bfs )
    poj 3126 Prime Path( bfs + 素数)
    Atcoder ARC-063
    Atcoder ARC-062
    Atcoder ARC-061
    Atcoder ARC-060
    Atcoder ARC-058
  • 原文地址:https://www.cnblogs.com/xuzhinan/p/6518133.html
Copyright © 2011-2022 走看看