a244: 新手訓練 ~ for + if
題目:http://zerojudge.tw/ShowProblem?problemid=a244
程式碼:
程式碼:
import java.util.Scanner; public class a244 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = sc.nextInt(); int a; long b,c; for(int i=1;i<=n;i++){ a = sc.nextInt(); b = sc.nextLong(); c = sc.nextLong(); switch(a){ case 1: System.out.println(b+c); break; case 2: System.out.println(b-c); break; case 3: System.out.println(b*c); break; case 4: System.out.println(b/c); break; } } } } }
留言
張貼留言