Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

2894这么简单的题怎么会出错?大家帮忙看一下那里不行:)

Posted by daryl at 2006-07-24 20:38:30
import java.io.*;
import java.util.*;

public class Main {
  public static void main(String args[]) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int light[] = new int[1001];
    String ch = new String();
    int a, b;
    String str = new String();
    int n = Integer.parseInt(br.readLine());
    while(n-- >= 0) {
      int t = Integer.parseInt(br.readLine());
      for(int s = 0; s < 1001; s++)
          light[s] = 0;
      while(t-- > 0) {
        str = br.readLine();
        StringTokenizer st = new StringTokenizer(str);
        ch = st.nextToken();
        a = Integer.parseInt(st.nextToken());
        b = Integer.parseInt(st.nextToken());
        for(int i = a; i < b; i++)
          light[i]++;
      }
      for(int j = 0; j < 1001; j++)
      {
        if(light[j] != 0)
          System.out.print(""+(char)('@'+light[j]));
          System.out.flush();
      }

      System.out.println("");
      n--;
    }
  }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator