SGU题库第四版前10题的题目解答。前三题是CPP程序

源代码在线查看: sgu404.java

软件大小: 8 K
上传用户: xushenghao001
关键词: SGU CPP 题库 程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				import java.io.*;
				import java.util.*;
				
				public class Solution implements Runnable {
					Scanner in;
					PrintWriter out;
					
					public void run() {
						try {
							in = new Scanner(new FileReader("input.txt"));
							out = new PrintWriter(System.out);
							int n, m, i;
							String str;
							while (in.hasNextInt()) {
								n = in.nextInt();
								m = in.nextInt();
								//out.println(n + " and " + m);
								in.nextLine();
								for (i = 0; i < m; i++) {
									str = in.nextLine();
									if (i == (n - 1) % m) out.println(str);
								}
							}
							in.close();
							out.close();
						}
						catch (Exception ex) {
							ex.printStackTrace();
							System.exit(-1);
						}
					}
					
					public static void main(String args[]) {
						new Thread(new Solution()).start();
					}
				}			

相关资源