新浪明星日誌熱門推薦(java實現)
現在進行推薦的第三步:
1:利用資料的格式如下:
2:程式語言採用的是Java,原始碼如下:
package top10;
import java.util.*;
import java.io.*;
public class top {
public static void top(String []one,String []two,String []three){
int []one1 = new int[15688];
for(int i =0;i<15687;i++)
{
one1[i]=0;
for(int j=i;j<15688;j++)
if(one[j]==one[i])
{
one1[i]++;
}
}
for(int i =0;i<15688;i++)
for(int j=i;j<15688;j++)
if(one1[i]>one1[j])
{
String temp1;
temp1=one[i];
one[i]=one[j];
one[j]=temp1;
String temp2;
temp2=two[i];
two[i]=two[j];
two[j]=temp2;
String temp3;
temp3=three[i];
three[i]=three[j];
three[j]=temp3;
}
System.out.println("Top前十的結果為:");
System.out.println("姓名\t"+"\t推薦部落格地址"+"\t\t\t\t\t\t\t\t\t\t\t"+"推薦作者部落格首地址");
for(int k=1;k<=10;k++)
{
String str;
str = String.format("%s\t\t%s\t\t%s", one[k],two[k],three[k]);
System.out.println(str);
}
}
public static void list() throws IOException{
FileReader in = new FileReader("title.txt");
BufferedReader br = new BufferedReader(in);
String s1 = null;
String []one = new String[15688];
String []two = new String[15688];
String []three = new String[15688];
int i = 0,k=0,m=0,j = 1;
while((s1 = br.readLine()) != null) {
if(j%3==2)
{
two[k] = s1;
k++;
}
else if(j%3==0)
{
three[m] = s1;
m++;
}
else
{
one[i] = s1;
i++;
}
j++;
}
br.close();
in.close();
// System.out.println(j);
top(one,two,three);
}
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.out.println("+++++++++++++++++|||||||||||||||++++++++++++++++++");
System.out.println("**************歡迎使用新浪明星部落格推薦系統 ***************");
System.out.println("************** 1、使用推薦功能 ***************");
System.out.println("************** 2、退出此係統,謝謝使用 ***************");
System.out.println("+++++++++++++++++|||||||||||||||++++++++++++++++++");
Scanner in = new Scanner(System.in);
while(true)
{
int i = in.nextInt();
{
switch(i)
{
case 1: list();break;
case 2:System.out.println("謝謝使用!!!");break;
default:System.out.println("請重新輸入!!!");
}
}
}
}
}
3:執行的結果如圖:
相關文章
- 熱門API介面整理推薦API
- Redis實現使用者熱詞推薦Redis
- Github 上熱門的 Spring Boot 專案實戰推薦GithubSpring Boot
- 推薦 Python 日誌模組 mongodb-logPythonMongoDB
- 各類熱門免費API介面推薦API
- 各種各類好用熱門API推薦API
- 各類熱門的免費API推薦API
- 寶藏api推薦,熱門、免費、好用API
- 推薦系統入門之使用協同過濾實現商品推薦
- 推薦10個Java方向最熱門的開源專案(8月)Java
- Java 日誌快取機制的實現Java快取
- 常用且熱門的漏洞管理工具推薦!
- 有意思、好用、熱門的免費API推薦API
- 推薦一些免費可用的熱門 APIAPI
- 都比iPhone好看 近期熱門金屬手機推薦iPhone
- 5 款熱門開源SNS社群系統推薦
- 強烈推薦的各種熱門好用的介面
- 新手玩自媒體,推薦這2個熱門領域,實現穩定收入200左右
- online清理oracle 監聽日誌推薦的做法Oracle
- 大家推薦哪個 golang 的日誌框架,說說理由?Golang框架
- APISpace 熱門好用的API推薦,含免費次數API
- Java 日誌管理最佳實踐Java
- 博文推薦|Apache Pulsar 基於 Log4j2+Kafka+ELK 實現日誌的快速檢索ApacheKafka
- 成品直播原始碼推薦,java 實現郵件服務原始碼Java
- SpringBoot日誌實現Spring Boot
- 程式設計師強烈推薦的熱門免費api程式設計師API
- 推薦16個下載超酷指令碼的熱門網站指令碼網站
- 熱門便攜平板全推薦 玩轉小尺寸沒商量
- 熱門中高階國產智慧機推薦 2999元起步
- Java日誌框架:slf4j作用及其實現原理Java框架
- 日曆形式實現解析薦
- 百億級日誌流分析實踐 | 剖析個推後效分析功能實現原理
- 勞逸結合好選擇 熱門高效能遊戲本推薦遊戲
- 構建高效系統:必備熱門API介面集合的推薦API
- Yii使用DbTarget實現日誌功能
- 使用 Serverless 實現日誌報警Server
- .Net Core 審計日誌實現
- Rust 實現日誌記錄功能Rust