package tv;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[6000];
int[] count=new int[400];
int[] page=new int[400];
int[] p1=new int[400];
int[] p2=new int[400];
public static void main(String[] args){
pro te=new pro();
}
pro(){
readx("data.txt");
for(s=1;s<datanumber+1;s++){
String str=data[s];
count[s]=str.length();
System.out.println(s+","+data[s]);
}
int m=0;
page[1]=1;
for(s=1;s<datanumber;s++){
m=count[s]+m;
page[s+1]=page[s];
if(m>100)page[s+1]=page[s]+1;
if(m>100)m=0;
}
int number=page[datanumber];
System.out.println(number);
for(s=1;s<datanumber+1;s++){
int n1=page[s];
if(p1[n1]==0)p1[n1]=s;
p2[n1]=s;
}
int sx;
for(s=1;s<number+1;s++){
System.out.println("<section>");
for(sx=p1[s];sx<p2[s]+1;sx++){
System.out.println("<p>"+data[sx]+"</p>");
}
System.out.println("</section>");
}
}
void readx(String file){
String str;
BufferedReader br;
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
最終更新:2016年05月29日 13:56