Codeforces Round #429 (Div. 1), problem: (E) In a Trap Solution In Java

By | 2017-08-21T13:22:15+00:00 August 21st, 2017|Categories: Java, Programming|Tags: , , , , , |

import java.io.*; import java.util.*; public class E { int[] a; static final int LOG = 8; static final int BLOCK = 1 << LOG; static final int LOW_MASK = BLOCK - 1; int[] head; int[] next; int[] to; int[] par; int[] depth; void dfs(int [...]

Codeforces Round #421 (Div. 2), problem: (C) Mister B and Boring Game Solution In JAVA

By | 2017-08-05T22:03:27+00:00 August 5th, 2017|Categories: Java, Programming|Tags: , , , |

import java.util.Scanner; public class C { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int a=in.nextInt(); int b=in.nextInt(); int l=in.nextInt(); int r=in.nextInt(); System.out.println(fun(a,b,l,r)); } static int fun(int a,int b,int l,int r){ if ((r-l+1)>2*(a+b)) if (a<=b) return [...]

Codeforces Round #415 (Div. 2), problem: (E) Find a car Solution In JAVA

By | 2017-07-24T16:57:47+00:00 July 24th, 2017|Categories: Java, Programming|Tags: , , |

import java.util.*; public class C{ final int MOD = (int)1e9 + 7; long get(int x, int y, int lim){ if (Math.min(x,y) < 0) return 0L; long[][][][] d = new long[32][2][2][2], sm = new long[32][2][2][2]; d[31][1][1][1] = 1; for (int w = 30; w >= [...]

Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2), problem: (G) Cut the pie Solution In JAVA

By | 2017-07-24T13:31:05+00:00 July 24th, 2017|Categories: Java, Programming|Tags: , , , , , , |

import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream [...]

Codeforces Round #412 (rated, Div. 1, based on VK Cup 2017 Round 3), problem: (E) Blog Post Rating Solution In JAVA

By | 2017-07-24T02:42:50+00:00 July 24th, 2017|Categories: Java, Programming|Tags: , , , , , , |

import static java.lang.Double.parseDouble; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Math.min; import static java.lang.System.exit; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Random; import java.util.StringTokenizer; public class E { static BufferedReader in; static PrintWriter out; static StringTokenizer tok; static int [...]

Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3), problem: (F) Perishable Roads Solution In JAVA

By | 2017-07-24T02:40:45+00:00 July 24th, 2017|Categories: Java, Programming|Tags: , , , , , , , , , , |

import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class Div2_412F { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int numV = Integer.parseInt(reader.readLine()); long[][] [...]

Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2), problem: (E) Vulnerable Kerbals Solution in JAVA

By | 2017-07-24T01:31:20+00:00 July 24th, 2017|Categories: Java, Programming|Tags: , , , , , , |

import java.util.ArrayList; import java.util.Scanner; /* 4 10 2 4 6 8 4 10 2 9 1 0 */ public class e { static ArrayList<Integer>[] gcdLists; public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(),m=in.nextInt(); boolean[] forbid = new [...]

Drawing A Hollow Rectangle Using Java

By | 2017-04-07T22:11:51+00:00 October 29th, 2016|Categories: Java, Programming|Tags: , , , , , , |

hello people, here is easy code for drawing a hollow rectangle using java. this code displays a rectangle of given length and width. Sample input: 4 5 Sample output ***** *      * *      * ***** import java.util.Scanner; public class hollowRectangle{ [...]

Drawing Isosceles Triangle of A Given Height Using Java

By | 2017-04-07T22:11:51+00:00 October 26th, 2016|Categories: Java, Programming|Tags: , , , , , , |

hey everyone so i tried write a code on drawing isosceles. if you have any easier ways to solve it do let me know... import java.util.Scanner; public class task{ public static void main(String args[]){ Scanner anik = new Scanner(System.in); System.out.println("give a line number"); int [...]