Created
May 19, 2010 15:42
-
-
Save anonymous/406451 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Main2 { | |
| public static void main(String[] args) { | |
| // 直接把測資寫進陣列了 | |
| int[] lArr = {2147483647, 2146483647}; | |
| int[] rArr = {2147483647, 2147483647}; | |
| // 如果只讀第二筆就沒問題,所以只要把 c 初始為 1 就會得到正常結果 | |
| for(int c=0;c<2;c++){ // 一定要寫成迴圈,拆開來就沒問題 | |
| System.out.println("Case "+(c+1)+":"); // 方便看 output 而已,沒其他用途 | |
| int l = lArr[c]; | |
| int u = rArr[c]; | |
| // 這兩行一定要存在... | |
| for(int p=100000;p<200000;p++){ | |
| for(int i=l;i<=u&&i>=0;i+=p){ | |
| } | |
| } | |
| /* 因為第二組的範圍是 214'6'483647 ~ 214'7'483647 | |
| * 以正確結果應該是會印出好幾行,錯誤的結果則是只印一行 | |
| */ | |
| for(int i=l;i<=u&&i>=0;i+=100000){ // 加上 long 就會正確 | |
| System.out.println(i); | |
| } | |
| System.out.println(); // 方便看 output 而已,沒其他用途 | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment