[JAVA] Enjoy competitive programming with AOJ using the popular editor SublimeText2

What language can I use?

Available languages are C, C ++, C #, C ++ 11, D, Java, Python, Ruby, PHP, JavaScript

What is SublimeText2?

If you haven't used the popular text editor yet, take a look here and open your eyes to its splendor. ~~ Sublime Text 2 has a really good editor. Make a note of the initial settings and usage when switching from Dreamweaver ~~ Since the link seems to be broken, I will introduce a different site Thank you @Accent. "Falling Editor" "Sublime Text" Complete Introductory Guide!

What is AOJ?

Abbreviation for Aizu Online Judge A site that programs and solves the questions to be asked and judges pass / fail The title of the problem is English, but the content is also in Japanese, so please forgive me for the U-turn immediately.

Introduction

-Installation of Sublime Text 2 ・ Create AOJ account Please do these two

Install Sublime Text 2 Plugin

Install Aizu Online Judge Plugin See the linked README for installation instructions Don't forget to change the UserName and Password in the settings file

Solve the problem and submit to AOJ

** ・ Problem selection ** Hover over PROBLEM to get a set of questions First, try to solve the 10000: Hello World of Volume 100 in it. 問題

** ・ Program creation ** Open SublimeText2 and press ctrl + shift + p to display the Command Palette ʻAizu Online Judge: Select Create File`, Input Panel will be displayed below, enter the language to use Look at the bottom right to see if it's your language, this example uses Ruby syntax

** ・ Submit to AOJ ** Open Command Palette with ctrl + shift + p, select ʻAizu Online Judge: Submit for Prompt, and enter the Problem No 10000` for this issue in the Input Panel.

If you want to do it while saving the file, add ProblemNo to the file name and use ʻAizuOnlineJudge: Submit` to judge from the file name and submit

・ Volume 0 or problem sentences in English, right? Mendokusai, but please jump to the Japanese problem from the Japanese version here 日本語

・ I want to see people's sources Click the magnifying glass icon in the upper right to see the source of the person who selected Source Code Policy: public when creating an account ソース

That's all for the explanation, Let's Enjoi AOJ Life!

Compiler and system details

language compiler
C gcc 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)
C++ gcc 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)
C++11 gcc 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)
JAVA java: version 1.6.0
C# C# mono 2.10.5
D DMD64 D Compiler v2.059
Ruby Ruby 1.8.7
Python Python 2.7.2
PHP PHP 5.3.14
JavaScript Node.js 0.8.16

Tips ・ Input uses an input function -Even if it says "Output in order", it is not necessary to input everything and then output, it is OK to output in sequence -How to get space breaks for multiple lines

C


while( scanf("%d %d", &a, &b) != EOF )

C++


while( cin >> a >> b )

Java


Scanner sc = new Scanner(System.in);
while( sc.hasNext() ){
	String[] line = sc.nextLine().split(" ");
	int a = Integer.parseInt(line[0]);
	int b = Integer.parseInt(line[1]);
}

C#


string line;
while ( !string.IsNullOrEmpty(line = System.Console.ReadLine()) ) {
	string[] ab = line.Split(' ');
	int a = Convert.ToInt32(ab[0]);
	int b = Convert.ToInt32(ab[1]);
}

D


while( readf("%d %d\n",&a,&b) ){
}

Ruby


#Since 0 is returned when nil, gets under the while condition.to_i do not
while line = gets do
	a,b = line.split.map(&:to_i)
end

Python


for line in sys.stdin.readlines():
    a,b = map(int, line.strip().split())

PHP


while( TRUE ) {
	fscanf(STDIN, "%d %d", $a, $b);
    if( feof(STDIN) )
        break;
}

-How to get comma delimiters for multiple lines

C


scanf("%d,%d", &a, &b)

C++


int a, b;
char c;
//c is a variable for removing commas
cin >> a >> c >> b

Java


Scanner sc = new Scanner(System.in);
while( sc.hasNext() ){
	String[] line = sc.nextLine().split(",");
	int a = Integer.parseInt(line[0]);
	int b = Integer.parseInt(line[1]);
}

C#


string line;
while ( !string.IsNullOrEmpty(line = System.Console.ReadLine()) ) {
	string[] ab = line.Split(',');
	int a = Convert.ToInt32(ab[0]);
	int b = Convert.ToInt32(ab[1]);
}

Ruby


line = gets
a,b = line.split(',')

Python


line = sys.stdin.readlines()
a,b = map(int, line.strip().split(','))

I didn't know how to separate D and PHP from commas, so I'd be very happy if anyone could request an edit. This is better than this, please let me know if you like

Recommended Posts

Enjoy competitive programming with AOJ using the popular editor SublimeText2
Competitive programming with python
Enjoy the Gray-Scott model with short code using matrix math
Debug the script with Sakura Editor
Using cgo with the go command
Competitive programming with python Local environment settings
Behind the flyer: Using Docker with Python
Try using the camera with Python's OpenCV
Working with OpenStack using the Python SDK
Play with puns using the COTOHA API