<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小程序
    主站蜘蛛池模板: 亚洲桃色AV无码| 亚洲精品第一国产综合亚AV| 国产偷国产偷亚洲高清人| 五级黄18以上免费看| 免费国产真实迷j在线观看| 亚洲精品美女久久7777777| 成年私人影院免费视频网站| 亚洲欧洲AV无码专区| 免费理论片51人人看电影| 亚洲精品国产精品乱码在线观看| 国产精品高清免费网站 | 免费看美女让人桶尿口| 亚洲欧美黑人猛交群| 国产乱子伦片免费观看中字| 男女男精品网站免费观看| 在线亚洲精品福利网址导航| 999zyz**站免费毛片| 精品亚洲成a人片在线观看少妇| 91在线手机精品免费观看| 亚洲一区二区三区不卡在线播放 | 69影院毛片免费观看视频在线| 亚洲七七久久精品中文国产| 两个人看的www视频免费完整版| 亚洲AV福利天堂一区二区三| 蜜臀AV免费一区二区三区| 亚洲欧美综合精品成人导航| 亚洲第一网站男人都懂| 无码日韩精品一区二区三区免费 | 亚洲人成www在线播放| 国产精品嫩草影院免费| 精品国产成人亚洲午夜福利| 国产精品成人免费综合| a级成人毛片免费视频高清| 亚洲影视一区二区| 国产免费小视频在线观看| 成人黄网站片免费视频| 亚洲中文字幕AV在天堂| 亚洲一区二区三区无码影院| 日韩毛片免费一二三| 伊人久久综在合线亚洲2019| 免费无码一区二区三区蜜桃大 |