Group for student JAVA programmers

Hey guys! I am new to Codechef here and am dealing with many problems (like TLE for most of the time) myself while solving competitive problems. So, I’ve decided to take on the practice problems in Java but I’ve noticed that there are very few submissions there to see and learn from. So I’ve decide to make a group in FB which will act as a platform to discuss our problems and solutions with our fellow Java programmers here. Anyone interested may follow this link : Codechef Java Programmers | Facebook

1 Like

If you are getting TLE due to slow I/O don’t use Scanner class .

I was getting TLE due to slow I/O during during April Long 17 for CLIQUED.

check out this :- [faster I/O in JAVA][1]

Happy Coding :slight_smile:
[1]: Fast I/O in Java in Competitive Programming - GeeksforGeeks

1 Like

Most of the time TLE is due to the naive algorithm and not I/O, but in JAVA it is good to use faster I/O.

1 Like

This is a code here for fast input output .

/FOR FAST INPUT/

static class Reader {

final private int BUFFER_SIZE = 1 << 16;

private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;

public Reader()
{
    din = new DataInputStream(System.in);
    buffer = new byte[BUFFER_SIZE];
    bufferPointer = bytesRead = 0;
}

public Reader(String file_name) throws IOException
{
    din = new DataInputStream(new FileInputStream(file_name));
    buffer = new byte[BUFFER_SIZE];
    bufferPointer = bytesRead = 0;
}

public String readLine() throws IOException
{
    byte[] buf = new byte[64]; // line length
    int cnt = 0, c;
    while ((c = read()) != -1)
    {
        if (c == '\n')
            break;
        buf[cnt++] = (byte) c;
    }
    return new String(buf, 0, cnt);
}

public int nextInt() throws IOException
{
    int ret = 0;
    byte c = read();
    while (c <= ' ')
        c = read();
    boolean neg = (c == '-');
    if (neg)
        c = read();
    do
    {
        ret = ret * 10 + c - '0';
    }  while ((c = read()) >= '0' && c <= '9');

    if (neg)
        return -ret;
    return ret;
}

public long nextLong() throws IOException
{
    long ret = 0;
    byte c = read();
    while (c <= ' ')
        c = read();
    boolean neg = (c == '-');
    if (neg)
        c = read();
    do {
        ret = ret * 10 + c - '0';
    }
    while ((c = read()) >= '0' && c <= '9');
    if (neg)
        return -ret;
    return ret;
}

public double nextDouble() throws IOException
{
    double ret = 0, div = 1;
    byte c = read();
    while (c <= ' ')
        c = read();
    boolean neg = (c == '-');
    if (neg)
        c = read();

    do {
        ret = ret * 10 + c - '0';
    }
    while ((c = read()) >= '0' && c <= '9');

    if (c == '.')
    {
        while ((c = read()) >= '0' && c <= '9')
        {
            ret += (c - '0') / (div *= 10);
        }
    }

    if (neg)
        return -ret;
    return ret;
}

private void fillBuffer() throws IOException
{
    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
    if (bytesRead == -1)
        buffer[0] = -1;
}

private byte read() throws IOException
{
    if (bufferPointer == bytesRead)
        fillBuffer();
    return buffer[bufferPointer++];
}

public void close() throws IOException
{
    if (din == null)
        return;
    din.close();
}

}

public static void main(String args[]) throws IOException{
Reader in=new Reader();
int t=in.nextInt();

}
//FINISH

i don’t think my algorithms are naive all the time. :frowning:

thanks for the link

JAVA programming challenge

COURSEWORK TITLE

COURIER SERVICE SYSTEM

1.0 THE COURSEWORK OVERVIEW

The assignment is to design and implement a stand alone Courier Service System. There are 2 types of end users interacting to the system:

i. Managing Staff

ii. Delivery Staff

All the end users are required to login for authentication and authorization purposes.

2.0 OBJECTIVES OF THIS COURSEWORK

Develop the practical ability to describe, justify, and implement an object-oriented system.

3.0 LEARNING OUTCOMES

At the end of this coursework, you should be able to:

· Design and develop a software solution using object-oriented paradigm and translate it into software application that exploit the strength of object-oriented paradigm (C6, PLO2)

· Demonstrate object-oriented concepts and their functionalities in the existing system (A3, PLO4)

4.0 TYPE

Group Assignment (2 in a group); each member is expected to complete 50% of all functional requirements.

5.0 COURSEWORK DESCRIPTION

Managing staff will handle user account management, order management, feedback management, and report management.

• Delivery staff will handle delivery management and individual profile management. You are also required to identify the relationship among the entities and also develop the necessary methods needed to fulfil the requirements of the expected systems.

6.0 GENERAL REQUIREMENTS

· The program submitted should compile and be executed without errors · Validation should be done for each entry from the users in order to avoid logical errors.

· The implementation code must highlight the use of object-oriented programming concepts as required by the solution.

· Students should use text files for storing and retrieving data required for the system. · Not allowed to use any database tools like access / oracle etc.