hiho一下
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main {
static Scanner scanner;
static boolean debug=true;
int a,b,c;
void read(){
a=scanner.nextInt();
b=scanner.nextInt();
}
void calc(){
c=a+b;
}
void output(){
System.out.println(c);
}
public static void main(String[] args) throws FileNotFoundException {
scanner=new Scanner(System.in);
if(debug)
scanner=new Scanner(new File("d:/in.txt"));
Main obj= new Main();
while(scanner.hasNext()){
obj.read();
obj.calc();
obj.output();
}
}
}
HDOJ
要求类名为Main,不能含有package。
package com.yichudu;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main {
static Scanner scanner;
static boolean debug=false;
void read(){
}
void calc(){
}
void output(){
}
public static void main(String[] args) throws FileNotFoundException {
scanner=new Scanner(System.in);
if(debug)
scanner=new Scanner(new File("d:/in.txt"));
int ncase=scanner.nextInt();
Main obj= new Main();
while(ncase-->0){
obj.read();
obj.calc();
obj.output();
}
}
}