返回列表 發帖
  1. import java.util.Scanner;
  2. import java.io.FileReader;
  3. import java.io.BufferedReader;
  4. public class Ch04 {

  5.         
  6.         public static void main(String args[])
  7.         {
  8.                
  9.                 Scanner s=new Scanner(System.in);
  10.                 String str;
  11.                 int[] n=new int[3];
  12.                 for(int i=0; i<=2; i++)
  13.                 {
  14.                         n[i]=s.nextInt();
  15.                 }
  16.                 try
  17.                 {
  18.                      
  19.                         BufferedReader br=new BufferedReader(new FileReader("read.txt"));
  20.                         for(int i=0; i<=2; i++)
  21.                         {
  22.                                 str=br.readLine();
  23.                                 for(int j=0; j<str.length(); j++)
  24.                                 {
  25.                                         if(j<n[i])
  26.                                         {
  27.                                                 System.out.print(n[i]);
  28.                                         }
  29.                                         else
  30.                                         {
  31.                                                 System.out.print(str.charAt(j));
  32.                                         }
  33.                                 }
  34.                                 System.out.println();
  35.                         }
  36.                        
  37.                 }
  38.                 catch(Exception e)
  39.                 {
  40.                         System.out.println("error");
  41.                 }
  42.                
  43.         }
  44.         

  45. }
複製代碼

TOP

返回列表