<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    march alex's blog
    hello,I am march alex
    posts - 52,comments - 7,trackbacks - 0
    目前做到能分析POJ和HDU的代碼。ZOJ的話因為他存儲用戶的方式是一個數字序列,而不是用戶的id,所以暫時沒有想到解決方案。
    這里用到了之前提到的獲取網頁源代碼的URLAnalysis類。
    getPOJSolved方法用于獲得POJ上的解題數;
    getHDUSolved方法用于獲得HDU上的解題數;
    names數組存放感興趣的用戶。
    代碼如下:
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.net.HttpURLConnection;
    import java.net.URL;


    public class OnlineJudgeFinder {
        
        private static String[] names = {"watashi", "hanfei19910905", "marchalex"};
        
        public static String getPOJSolved(String userId) throws Exception {
            String urlString = "http://poj.org/userstatus?user_id=" + userId;
            URL url = new URL(urlString);
            HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
            BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
            String line = null;
            for(int i=0;i<10;i++)
                line = reader.readLine();
            int len = line.length();
            int i , cnt = 0;
            for(i=0;i<len;i++) {
                if(line.charAt(i) == '>') {
                    cnt ++;
                    if(cnt == 2)
                        break;
                }
            }
            i ++;
            String num = "";
            while(i < len && line.charAt(i) >= '0' && line.charAt(i) <= '9') {
                num += line.charAt(i);
                i ++;
            }
            return num;
        }
        public static String getHDUSolved(String userId) throws Exception {
            String urlString = "http://acm.hdu.edu.cn/userstatus.php?user=" + userId;
            URL url = new URL(urlString);
            HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
            BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
            String line = null;
            for(int i=0;i<105;i++)
                line = reader.readLine();
            int len = line.length();
            int i , cnt = 0;
            for(i=0;i<len;i++) {
                if(line.charAt(i) == '>') {
                    cnt ++;
                    if(cnt == 4)
                        break;
                }
            }
            i ++;
            String num = "";
            while(i < len && line.charAt(i) >= '0' && line.charAt(i) <= '9') {
                num += line.charAt(i);
                i ++;
            }
            return num;
        }
        public static void getResult() throws Exception {
            int n = names.length;
            for(int i=0;i<n;i++) {
                String name = names[i];
                System.out.println(name + " has solved ");
                System.out.println("\t" + getPOJSolved(name) + " problem(s) in POJ");
                System.out.println("\t" + getHDUSolved(name) + " problem(s) in HDU");
            }
        }
        public static void main(String[] args) throws Exception {
            getResult();
        }
    }
    效果如下:
    watashi has solved 
    32 problem(s) in POJ
    7 problem(s) in HDU
    hanfei19910905 has solved 
    131 problem(s) in POJ
    212 problem(s) in HDU
    marchalex has solved 
    1 problem(s) in POJ
    15 problem(s) in HDU
    posted on 2015-02-13 13:30 marchalex 閱讀(232) 評論(0)  編輯  收藏 所屬分類: java小程序
    主站蜘蛛池模板: 亚洲精品视频专区| 亚洲不卡影院午夜在线观看| 国产精品亚洲产品一区二区三区| 女人被弄到高潮的免费视频| 在线观看免费人成视频色| 91免费资源网站入口| 成人免费午夜在线观看| 大学生一级特黄的免费大片视频| 无码人妻精品一二三区免费| 国产成人免费高清激情视频| 精品无码国产污污污免费| 日韩精品亚洲专区在线观看| aⅴ免费在线观看| 免费看黄视频网站| 在线观看人成视频免费| 免费一区二区三区四区五区| 亚洲熟女乱综合一区二区| 亚洲精品无码Av人在线观看国产| 久久亚洲AV无码精品色午夜麻| 亚洲美女色在线欧洲美女| 亚洲精品综合在线影院| 精品亚洲av无码一区二区柚蜜| 成人免费视频一区二区| 东方aⅴ免费观看久久av| 美女视频黄频a免费| jizz免费在线影视观看网站| 好紧我太爽了视频免费国产| 国产高清免费视频| 国产精品免费视频播放器| 国产成人毛片亚洲精品| 亚洲狠狠久久综合一区77777| 亚洲一线产区二线产区精华| 精品亚洲福利一区二区| 国产午夜精品理论片免费观看| 8x8x华人永久免费视频| 日韩精品视频免费在线观看| 亚洲最大av无码网址| 亚洲综合区图片小说区| 国产精品亚洲专区在线播放| 两个人看www免费视频| 国拍在线精品视频免费观看|