Advertisement
Drakconp

Untitled

Feb 6th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.07 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileNotFoundException;
  3. import java.util.Scanner;
  4.  
  5.  
  6. public class Average {
  7.  
  8. public static void main(String[] args) throws FileNotFoundException {
  9. Scanner scan = new Scanner(new File("average.in"));
  10.  
  11. }
  12.  
  13. }
  14.  
  15.  
  16. public class Easy {
  17.  
  18. public static void main(String[] args) {
  19. System.out.println("This was unexpectedly easy.");
  20. }
  21. }
  22.  
  23. import java.io.File;
  24. import java.io.FileNotFoundException;
  25. import java.util.Scanner;
  26.  
  27.  
  28. public class Lithp {
  29.  
  30. public static void main(String[] args) throws FileNotFoundException {
  31. Scanner scan = new Scanner(new File("lithp.in"));
  32. int test = scan.nextInt();
  33. scan.nextLine();
  34. for(int i = 0; i < test; i++) {
  35. System.out.println(scan.nextLine().replace("s", "th"));
  36. }
  37. }
  38.  
  39. }
  40.  
  41.  
  42. import java.io.File;
  43. import java.io.FileNotFoundException;
  44. import java.util.Scanner;
  45.  
  46. public class Metanumbers {
  47.  
  48. public static void main(String[] args) throws FileNotFoundException {
  49. Scanner scan = new Scanner(new File("metanumbers.in"));
  50. int test = scan.nextInt();
  51. scan.nextLine();
  52.  
  53. }
  54. }
  55.  
  56. import java.io.File;
  57. import java.io.FileNotFoundException;
  58. import java.util.Scanner;
  59.  
  60. public class Mirror {
  61.  
  62. public static void main(String[] args) throws FileNotFoundException {
  63. Scanner scan = new Scanner(new File("esrever.in"));
  64. int nums = scan.nextInt();
  65. scan.nextLine();
  66. for(int i = 0; i < nums; i++) {
  67. String[] words = scan.nextLine().split(" ");
  68. for(int j = 1; j < words.length; j+=2) {
  69. String trans = "";
  70. for(int a = trans.length() - 1; a >= 0; a--) {
  71. trans += words[j].charAt(a);
  72. }
  73. words[j] = trans;
  74. }
  75.  
  76. for(String e: words) {
  77. System.out.print(e+ " ");
  78. }
  79. System.out.println("");
  80. }
  81. }
  82. }
  83.  
  84. import java.io.File;
  85. import java.io.FileNotFoundException;
  86. import java.util.Scanner;
  87.  
  88.  
  89. public class Msschniggles {
  90.  
  91. public static void main(String[] args) throws FileNotFoundException {
  92. Scanner scan = new Scanner(new File("msschniggles.in"));
  93. int test = scan.nextInt();
  94. scan.nextLine();
  95. for(int i = 0; i < test; i++) {
  96. String input = scan.nextLine();
  97. int times = scan.nextInt();
  98. scan.nextLine();
  99. for(int j = 0; j < times; j++) {
  100. System.out.println(input);
  101. }
  102. System.out.println("");
  103. }
  104. }
  105.  
  106. }
  107.  
  108. import java.io.File;
  109. import java.io.FileNotFoundException;
  110. import java.util.Scanner;
  111.  
  112. public class Multiplication {
  113.  
  114. public static void main(String[] args) throws FileNotFoundException {
  115. Scanner scan = new Scanner(new File("multiplicationsquare.in"));
  116. long num = scan.nextLong();
  117. for(long i = 1; i <= num; i++) {
  118. for(long j = 1; j <= num; j++) {
  119. System.out.print(i*j+ " ");
  120. }
  121. System.out.println("");
  122. }
  123. }
  124. }
  125.  
  126. import java.io.File;
  127. import java.io.FileNotFoundException;
  128. import java.math.BigInteger;
  129. import java.util.Scanner;
  130.  
  131.  
  132. public class Tens {
  133.  
  134. public static void main(String[] args) throws FileNotFoundException {
  135. Scanner scan = new Scanner(new File("tens.in"));
  136. int test = scan.nextInt();
  137. scan.nextLine();
  138. for(int i = 0; i < test; i++) {
  139. BigInteger e = new BigInteger(10 + "");
  140. System.out.println(e.pow(scan.nextInt()));
  141. }
  142. }
  143.  
  144. }
  145.  
  146. import java.io.File;
  147. import java.io.FileNotFoundException;
  148. import java.util.Scanner;
  149.  
  150.  
  151. public class WeirdSort {
  152.  
  153. public static void main(String[] args) throws FileNotFoundException {
  154. Scanner scan = new Scanner(new File("weirdsort.in"));
  155. int test = scan.nextInt();
  156. scan.nextLine();
  157. for(int i = 0; i < test; i++) {
  158. String[] input = scan.nextLine().split(" ");
  159. for(int j = 0; j < input.length; j++) {
  160. for(int k = 0; k < input.length - 1; k++) {
  161. char a0 = input[k].charAt(0);
  162. char b0 = input[k].charAt(1);
  163. char c0 = input[k].charAt(2);
  164. char a1 = input[k+1].charAt(0);
  165. char b1 = input[k+1].charAt(1);
  166. char c1 = input[k+1].charAt(2);
  167. if(b0 < b1) {
  168. String temp = input[k];
  169. input[k] = input[k+1];
  170. input[k+1] = temp;
  171. } else {
  172. if(c0 < c1) {
  173. String temp = input[k];
  174. input[k] = input[k+1];
  175. input[k+1] = temp;
  176. } else {
  177. if(a0 < a1) {
  178. String temp = input[k];
  179. input[k] = input[k+1];
  180. input[k+1] = temp;
  181. }
  182. }
  183. }
  184. }
  185. }
  186.  
  187. for(String e: input) {
  188. System.out.print(e+" ");
  189. }
  190. System.out.println("");
  191. }
  192. }
  193. }
  194.  
  195. import java.io.File;
  196. import java.io.FileNotFoundException;
  197. import java.util.Scanner;
  198.  
  199.  
  200. public class boolee {
  201.  
  202. public static void main(String[] args) throws FileNotFoundException {
  203. Scanner scan = new Scanner(new File("boolee.in"));
  204. int test = scan.nextInt();
  205. scan.nextLine();
  206. for(int i = 0; i < test; i++) {
  207. String[] data = scan.nextLine().split(" ");
  208. double result = 0;
  209. double tesst = 1;
  210. if(data[0].equals("ADD"))
  211. for(int a = 1; a < data.length; a++)
  212. result += Double.parseDouble(data[a]);
  213. else if(data[0].equals("SUB")) {
  214. tesst = Double.parseDouble(data[1]);
  215. for(int a = 2; a < data.length; a++)
  216. tesst -= Double.parseDouble(data[a]);
  217. }
  218. else if(data[0].equals("MUL"))
  219. for(int a = 1; a < data.length; a++)
  220. tesst *= Double.parseDouble(data[a]);
  221. else {
  222. tesst = Double.parseDouble(data[1]);
  223. for(int a = 2; a < data.length; a++) {
  224. tesst /= Double.parseDouble(data[a]);
  225. }
  226. }
  227.  
  228. System.out.print(data[0]+" ");
  229. System.out.printf("%.2f%n", result);
  230.  
  231.  
  232.  
  233. }
  234. }
  235.  
  236. }
  237.  
  238. import java.io.File;
  239. import java.io.FileNotFoundException;
  240. import java.util.Scanner;
  241.  
  242.  
  243.  
  244. public class passfail {
  245.  
  246. public static void main(String[] args) throws FileNotFoundException {
  247. Scanner scan = new Scanner(new File("passfail.in"));
  248. scan.nextLine();
  249. while(scan.hasNextLine()) {
  250. String name = scan.nextLine();
  251. if(Integer.parseInt(name.replaceAll("[^1234567890]", "")) < 70) {
  252. System.out.println(name.replaceAll("[1234567890]", ""));
  253. }
  254.  
  255.  
  256. }
  257. }
  258.  
  259. }
  260.  
  261. import java.io.File;
  262. import java.io.FileNotFoundException;
  263. import java.util.Scanner;
  264.  
  265.  
  266. public class sleepingsally {
  267.  
  268. public static void main(String[] args) throws FileNotFoundException {
  269. Scanner scan = new Scanner(new File("sleepingsally.in"));
  270. int tests = scan.nextInt();
  271. scan.nextLine();
  272. for(int i = 0; i < tests; i++) {
  273. String[] data = scan.nextLine().split(" ");
  274. int length = Integer.parseInt(data[0]);
  275. int width = Integer.parseInt(data[1]);
  276. Node[][] mat = new Node[length][width];
  277. Node start = new Node('F');
  278. for(int c = 0; c < length; c++) {
  279. char[] ar = scan.nextLine().toCharArray();
  280. for(int d = 0; d < width; d++) {
  281. mat[c][d] = new Node(ar[d]);
  282. if(mat[c][d].c == 'S') {
  283. start = mat[c][d];
  284. }
  285. }
  286. }
  287. int time = scan.nextInt();
  288. scan.nextLine();
  289. process(mat, time);
  290. }
  291. }
  292.  
  293. public static void process(Node[][] mat, int time) {
  294. boolean changed = true;
  295. while(changed) {
  296. changed = false;
  297. for(int i = 0; i < mat.length; i++) {
  298. for(int j = 0; j < mat[i].length; j++) {
  299. if(mat[i][j].c != '#') {
  300. for(int k = -1; k < 2; k++) {
  301. for(int l = -1; l < 2; l++) {
  302. if(l == 0 ^ k == 0) {
  303. try {
  304. if(mat[i][j].dist < mat[i+k][j+l].dist-1) {
  305. mat[i+k][j+l].dist = mat[i][j].dist+1;
  306. changed = true;
  307. }
  308. } catch(Exception e) {}
  309. }
  310. }
  311. }
  312. }
  313. }
  314. }
  315. }
  316.  
  317. for(int i = 0; i < mat.length; i++) {
  318. for(int j = 0; j < mat[i].length; j++) {
  319. if(mat[i][j].c == 'S') {
  320. System.out.println((mat[i][j].dist < time || (mat[i][j].dist == 8 && time == 8)) ? "Success" : "Failure");
  321. }
  322. }
  323. }
  324. }
  325.  
  326. }
  327.  
  328.  
  329. class Node {
  330. public int dist;
  331. public char c;
  332.  
  333. public Node(char c) {
  334. this.c = c;
  335. if(c == '#') {
  336. dist = Integer.MIN_VALUE;
  337. } else if(c == 'B') {
  338. dist = 0;
  339. } else {
  340. dist = Integer.MAX_VALUE;
  341. }
  342. }
  343. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement