@XQF
2016-10-07T12:21:33.000000Z
字数 1748
阅读 1114
java作业
| 被除数/除数 | 有穷正数 | 有穷负数 | +0 | -0 | Infinity | -Infinity | NaN |
|---|---|---|---|---|---|---|---|
| 有穷正数 | 有穷正数 | 有穷负数 | ArithmeticEXception | ArithmeticEXception | NaN | NaN | NaN |
| 有穷负数 | 有穷负数 | 有穷正数 | ArithmeticEXception | ArithmeticEXception | NaN | NaN | NaN |
| +0 | 0 | 0 | ArithmeticEXception | ArithmeticEXception | NaN | NaN | NaN |
| -0 | 0 | 0 | ArithmeticEXception | ArithmeticEXception | NaN | NaN | NaN |
| Infinity | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| -Infinity | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
public class Solution {private int findMinScript(int[] nums) {int max = 0;for (int i : nums) {if (i > max) {max = i;}}for (int i = 0; i < nums.length; i++) {if (nums[i] == max) {return i;}}return 0;}public static void main(String[] args) {int[] nums = new int[] { 1, 3, 5, 7, 89, 3, 5, 78, 76, 89 };Solution s = new Solution();System.out.println(s.findMinScript(nums));}}
public class Solution {private int findLargestSumRaw(int[][] nums) {int maxRaw = 0;int counter = 0;for (int i = 0; i < nums.length; i++) {int sum = 0;for (int j = 0; j < nums[i].length; j++) {sum += nums[i][j];}if (sum > maxRaw) {maxRaw = sum;counter = i;}}return counter;}public static void main(String[] args) {int[][] nums = new int[][] { { 5, 45, 78, 3 }, { 32, 4, 66, 23 }, { 2, 54, 31, 9 } };Solution s = new Solution();System.out.println(s.findLargestSumRaw(nums));}}
某个翻译不出来的名字的理论
public class Solution {public static void main(String[] args) {Hello h = new Hello();int[] startDigit = new int[4];int[] productDigit = new int[4];for (int i = 10; i <= 99; i++) {for (int j = i; j <= 99; j++) {if ((i * j) % 9 != (i + j) % 9)continue;int m = i * j;startDigit[0] = i / 10;startDigit[1] = i % 10;startDigit[2] = j / 10;startDigit[3] = j % 10;productDigit[0] = m / 1000;productDigit[1] = (m % 1000) / 100;productDigit[2] = m % 1000 % 100 / 10;productDigit[3] = m % 1000 % 100 % 10;int count = 0;for (int x = 0; x < 4; x++) {for (int y = 0; y < 4; y++) {if (productDigit[x] == startDigit[y]) {count++;productDigit[x] = -1;startDigit[y] = -2;if (count == 4) {System.out.println(i + " * " + j + " : " + m);}}}}}}}}
