src
stringlengths
95
64.6k
complexity
stringclasses
7 values
problem
stringlengths
6
50
from
stringclasses
1 value
import java.util.Scanner; public class LuckyDivison { public static void main(String[] args) { Scanner in = new Scanner(System.in); int inp = in.nextInt(); if(inp%4==0||inp%7==0||inp%47==0||inp%74==0||inp%447==0||inp%474==0||inp%477==0||inp%747==0||inp%774==0||inp%777==0) { System.out.println("YES"); } else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.*; import java.util.*; public class Test{ public static void main(String[] args) { Scanner in= new Scanner(System.in); int n=in.nextInt(); if(n%7==0 || n%4==0 || n%47==0 || n%74==0 || n%447==0 || n%474==0 || n%477==0 || n%747==0 || n%774==0){ System.out.println("YES"); }else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class A122 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); if (n % 4 == 0 || n % 7 == 0 || n % 44 == 0 || n % 47 == 0 || n % 74 == 0 || n % 77 == 0 || n % 444 == 0 || n % 447 == 0 || n % 474 == 0 || n % 477 == 0 || n % 744 == 0 || n % 747 == 0 || n % 774 == 0 || n % 777 == 0) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String input = in.nextLine(); if (input.equals("1")) System.out.println("NO"); else { if (checkNum(input)) System.out.println("YES"); else { int i = 2; while (i < Integer.parseInt(input)) { if (checkNum(i + "")) { if (Integer.parseInt(input) % i != 0) i++; else break; } else i++; } if (i == Integer.parseInt(input)) System.out.println("NO"); else System.out.println("YES"); } } } public static boolean checkNum(String s) { int i = 0; int flag = 0; while (i < s.length()) { if (s.charAt(i) == '4' || s.charAt(i) == '7') { flag = 1; i++; } else return false; } if (flag == 1) return true; return false; } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; import java.io.*; public class A { ArrayList<Integer> list = new ArrayList<Integer>(); boolean valid(int n) { Queue<Integer> q = new LinkedList<Integer>(); q.add(4); q.add(7); int crnt; while(!q.isEmpty()) { crnt = q.poll(); if(n%crnt == 0) return true; if ( crnt*10 + 4 <= 1000 ) q.add(crnt*10 + 4); if ( crnt*10 + 7 <= 1000 ) q.add(crnt*10 + 7); } return false; } void dfs(int n){ if(n>1000)return; if(n!=0)list.add(n); n = n*10; dfs(n+4); dfs(n+7); } void run() { Scanner s = new Scanner(System.in); int n = s.nextInt(); if (valid(n)) { System.out.println("YES"); } else { System.out.println("NO"); } } public static void main(String[] args) { new A().run(); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class CF { BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st=null; private void solution() throws IOException{ int n=nextInt(); if((n % 4==0 && n>=4)||(n % 7==0 && n>=7) || (n % 44==0 && n>=44) || (n % 47==0 && n>=47) || (n % 77==0 && n>=77) || (n % 74==0 && n>=74) || (n % 444==0 && n>=444) || (n % 447==0 && n>=447) || (n % 474==0 && n>=74) || (n % 477==0 && n>=477) || (n % 744==0 && n>=744) || (n % 747==0 && n>=747) || (n % 777==0 && n>=777) || (n % 774==0 && n>=774)){ System.out.println("YES"); }else{ System.out.println("NO");} } String nextToken()throws IOException { if(st==null || !st.hasMoreTokens()){ st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } public static void main(String args[]) throws IOException { new CF().solution(); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.*; import java.util.*; public class LuckyDivision { public LuckyDivision(Scanner in) { int n; n = in.nextInt(); if ( (n % 4 == 0) || (n % 7 == 0) || (n % 44 == 0) || (n % 47 == 0) || (n % 74 == 0) || (n % 77 == 0) || (n % 444 == 0) || (n % 447 == 0) || (n % 474 == 0) || (n % 477 == 0) || (n % 744 == 0) || (n % 747 == 0) || (n % 774 == 0) || (n % 777 == 0) ) System.out.printf("YES%n"); else System.out.printf("NO%n"); } public static void main(String[] args) { new LuckyDivision(new Scanner(System.in)); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; public class D { public static void main(String args[]) { int n; Scanner in = new Scanner (System.in); n= in.nextInt(); if (n%4==0 || n%7==0 || n%44==0 || n%47==0 || n%444==0 || n%447==0 || n%474==0 || n%477==0 || n%744==0 || n%747==0 || n%774==0 || n%777==0) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; /** * @author Son-Huy TRAN * */ public class P122A_LuckyDivision { private static boolean isLuckyNumber(int number) { while (number > 0) { int digit = number % 10; if (digit != 4 && digit != 7) { return false; } number /= 10; } return true; } private static boolean isAlmostLuckyNumber(int number) { int max = (int) Math.sqrt(number); int i = 1; while (i <= max) { if (number % i == 0 && (isLuckyNumber(i) || isLuckyNumber(number / i))) { return true; } i++; } return false; } /** * @param args */ public static void main(String[] args) { try { // begin reading inputs InputStreamReader isr = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(isr); // reading inputs int input = Integer.parseInt(reader.readLine()); reader.close(); isr.close(); // end reading inputs boolean result = isAlmostLuckyNumber(input); System.out.println(result ? "YES" : "NO"); } catch (Exception e) { e.printStackTrace(); } } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; public class Lucky { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n = in.nextInt(); if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%474==0 || n%447==0 || n%774==0 || n%747==0 || n%477==0 || n%744==0)System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; import java.io.*; public class luckydivision { public static int i(String s){ return Integer.parseInt(s); } public static boolean solve(String k, int n){ int temp = i(k); if(temp > n){ return false; } if(n % temp == 0) return true; if(solve(k + "7", n)) return true; return solve(k + "4", n); } public static void main(String args[]) throws Exception { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); int n = i(r.readLine()); boolean i = solve("7", n); boolean j = solve("4", n); if(i || j){ System.out.println("YES"); } else { System.out.println("NO"); } } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; public class A122 { public static void main(String aa[]) { Scanner ob=new Scanner(System.in); int n; n=ob.nextInt(); if(n%4==0||n%7==0||n%44==0||n%47==0||n%444==0||n%447==0||n%474==0||n%477==0||n%744==0||n%747==0||n%774==0||n%777==0) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); String a=buffer.readLine(); int b=Integer.parseInt(a); if(b%4==0 || b%7==0 || b%44==0 || b%47==0 || b%74==0 || b%77==0 || b%444==0 || b%447==0 || b%474==0 || b%477==0 || b%744==0 || b%747==0 || b%774==0 || b%777==0) System.out.println("YES"); else System.out.println("NO"); }}
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class LuckyDivision{ public static void main(String [] args){ Scanner input = new Scanner(System.in); int a = input.nextInt(); if(a%4 == 0) System.out.println("YES"); else if(a%7 == 0) System.out.println("YES"); else if(a%47 == 0) System.out.println("YES"); else if(a%74 == 0) System.out.println("YES"); else if(a%447 == 0) System.out.println("YES"); else if(a%474 == 0) System.out.println("YES"); else if(a%477 == 0) System.out.println("YES"); else if(a%747 == 0) System.out.println("YES"); else if(a%774 == 0) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); if ((n % 4 == 0) || (n % 7 == 0) || (n % 44 == 0) || (n % 47 == 0) || (n % 74 == 0) || (n % 77 == 0) || (n % 444 == 0) || (n % 447 == 0) || (n % 474 == 0) || (n % 477 == 0) || (n % 744 == 0) || (n % 747 == 0) || (n % 774 == 0) || (n % 777 == 0)) { System.out.println("YES"); return; } System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; public class Main{ public static void main(String[]args){ Scanner input=new Scanner(System.in); int x=input.nextInt(); if(x%4==0||x%7==0||x%47==0||x%74==0||x%744==0||x%474==0||x%447==0||x%477==0||x%474==0) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.PrintWriter; import java.util.Scanner; import java.util.TreeSet; public class E { static Scanner in; static int next() throws Exception {return in.nextInt();}; // static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;} // static BufferedReader in; static PrintWriter out; public static void main(String[] args) throws Exception { in = new Scanner(System.in); // in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); // in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); int n = next(); if (n%4 == 0||n%7 == 0||n%44 == 0||n%47 == 0||n%74 == 0||n%77 == 0||n%444 == 0||n%447 == 0||n%474 == 0||n%744 == 0||n%774 == 0||n%747 == 0||n%477 == 0||n%777==0) out.println("YES"); else out.println("NO"); out.println(); out.close(); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.*; import java.util.*; public class z3 { public static boolean divch(int i,int a) { if (a>1000) return false; if ((a>0)&&(i%a==0)) return true; return (divch(i,a*10+4)||divch(i,a*10+7)); } public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); System.out.println(divch(in.nextInt(),0)?"YES":"NO"); } }
constant
122_A. Lucky Division
CODEFORCES
//package arbuz; import java.util.Scanner; public class Arbuz { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if (n % 4 == 0 || n % 7 == 0 || n % 47 == 0 || n % 74 == 0 || n % 444 == 0 || n % 447 == 0 || n % 474 == 0 || n % 477 == 0) { System.out.println("YES"); } else { System.out.println("NO"); } } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class Division { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int l = sc.nextInt(); String c = String.valueOf(l); if (String.valueOf(c).contains("0") || String.valueOf(c).contains("1") || String.valueOf(c).contains("2") || String.valueOf(c).contains("3") || String.valueOf(c).contains("5") || String.valueOf(c).contains("6") || String.valueOf(c).contains("8") || String.valueOf(c).contains("9")) if (l % 777 == 0 || l % 774 == 0 || l % 747 == 0 || l % 744 == 0 || l % 477 == 0 || l % 474 == 0 || l % 447 == 0 || l % 444 == 0 || l % 77 == 0 || l % 74 == 0 || l % 47 == 0 || l % 44 == 0 || l % 7 == 0 || l % 4 == 0) System.out.println("YES"); else System.out.println("NO"); else System.out.println("YES"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); if (n % 4 == 0 || n % 7 == 0 || n % 47 == 0 || n % 77 == 0 || n % 74 == 0 || n % 447 == 0 || n % 474 == 0 || n % 477 == 0 || n % 747 == 0 || n % 774 == 0 || n % 777 == 0) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; /** * Write a description of class lukno here. * * @author (your name) * @version (a version number or a date) */ public class lukno { public static void main (String args[]) { Scanner i= new Scanner(System.in); int n,p; n=i.nextInt(); int t=n; if(t%4==0||t%7==0||t%47==0||t%74==0||t%44==0||t%447==0||t%474==0||t%477==0) System.out.print("YES"); else System.out.print("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.LinkedList; public class LuckyNumbers { public static void main(String[] args)throws IOException { BufferedReader scan=new BufferedReader(new InputStreamReader(System.in)); short num=Short.parseShort(scan.readLine()); if(funcion(num)) { System.out.println("YES"); } else System.out.println("NO"); } public static boolean funcion(short num) { LinkedList<Short>queue=new LinkedList<Short>(); queue.offer((short) 4); queue.offer((short) 44); queue.offer((short) 444); queue.offer((short) 47); queue.offer((short) 477); queue.offer((short) 7); queue.offer((short) 77); queue.offer((short) 777); queue.offer((short) 74); queue.offer((short) 744); while(queue.peek()!=null) { if(num%queue.poll()==0) { return true; } } return false; } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); System.out.println((n%4==0||n%7==0||n%47==0||n%74==0||n%447==0||n%474==0||n%477==0||n%744==0||n%747==0||n%774==0)?"YES":"NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A implements Runnable { private void Solution() throws IOException { int n = nextInt(); if (n % 7 == 0 || n % 4 == 0 || n % 47 == 0 || n % 74 == 0 || n % 747 == 0 || n % 474 == 0 || n % 777 == 0 || n % 444 == 0 || n % 774 == 0 || n % 447 == 0 || n % 744 == 0 || n % 477 == 0) System.out.println("YES"); else System.out.println("NO"); } public static void main(String args[]) { new A().run(); } BufferedReader in; StringTokenizer tokenizer; public void run() { try { in = new BufferedReader(new InputStreamReader(System.in)); tokenizer = null; Solution(); in.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } int nextInt() throws NumberFormatException, IOException { return Integer.parseInt(nextToken()); } String nextToken() throws IOException { while (tokenizer == null || !tokenizer.hasMoreTokens()) tokenizer = new StringTokenizer(in.readLine()); return tokenizer.nextToken(); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class LuckyDivision { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); if( n % 4==0 || n % 7==0 || n % 47==0 || n % 74==0 || n % 447==0 || n % 474==0 || n % 477==0 || n % 744==0 || n % 774==0 || n % 777==0 ) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int in = sc.nextInt(); if( in%4==0|| in%7==0|| in%44==0|| in%47==0|| in%74==0|| in%77==0|| in%444==0|| in%447==0|| in%474==0|| in%477==0|| in%744==0|| in%747==0|| in%774==0|| in%777==0 ) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class Task122A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); if ( (n % 4 == 0) || (n % 7 == 0) || (n % 44 == 0) || (n % 47 == 0) || (n % 74 == 0) || (n % 77 == 0) || (n % 444 == 0) || (n % 447 == 0) || (n % 474 == 0) || (n % 477 == 0) || (n % 744 == 0) || (n % 747 == 0) || (n % 774 == 0) || (n % 777 == 0) ) { System.out.println("YES"); } else { System.out.println("NO"); } } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class A { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int a = scan.nextInt(); Queue<Integer> q = new LinkedList<Integer>(); q.add(4); q.add(7); boolean luck = false; while(!q.isEmpty() && !luck) { int f = q.poll(); if(a%f == 0) { luck = true; break; } if(f<a) { int t = (f+"").length(); int tt = (int)Math.pow(10, t); q.add(tt*4+f); q.add(tt*7+f); } } if(luck) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class HelloWorld { public static void main (String args []) { Scanner read = new Scanner(System.in); int n = read.nextInt(); int n1 = n; boolean q = true; while (n1 > 0) { if (n % n1 == 0) { if (check(n1)) { System.out.print("YES"); q = false; break; } } n1--; } if (q) System.out.print("NO"); } public static boolean check (int n) { int n1 = n; while (n1 != 0) { if (n1 % 10 != 4 && n1 % 10 != 7) return false; n1 /= 10; } return true; } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.PrintWriter; import java.util.Scanner; public class Solution { private static int n; private static PrintWriter writer; private static int maxstep; private static void g(int src, int step) { if (step != 0 && n % src == 0) { writer.print("YES"); writer.close(); System.exit(0); } if (step == maxstep) return; int p = (int)Math.pow(10, step); g(src + 4 * p, step + 1); g(src + 7 * p, step + 1); } public static void main(String[] args) throws Exception { //Scanner reader = new Scanner(new File("input.txt")); //PrintWriter writer = new PrintWriter("output.txt"); Scanner reader = new Scanner(System.in); writer = new PrintWriter(System.out); n = reader.nextInt(); maxstep = String.valueOf(n).length() + 1; g(0, 0); writer.print("NO"); writer.close(); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class LuckySubstring { static int[] luck; public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int i = -1; boolean ehLuck = false; preencheLucky(); while (n >= luck[++i]) { if (i > 13) { break; } if (n % luck[i] == 0) { ehLuck = true; break; } } if (ehLuck) { System.out.println("YES"); } else { System.out.println("NO"); } } static void preencheLucky() { luck = new int[15]; luck[0] = 4; luck[1] = 7; luck[2] = 44; luck[3] = 47; luck[4] = 74; luck[5] = 77; luck[6] = 444; luck[7] = 447; luck[8] = 474; luck[9] = 477; luck[10] = 744; luck[11] = 747; luck[12] = 774; luck[13] = 777; } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.PrintWriter; import java.util.Scanner; public class n122A { Scanner in; PrintWriter out; void solve() { int n = in.nextInt(); boolean good = false; if (n % 4 == 0) { good = true; } if (n % 7 == 0) { good = true; } if (n % 44 == 0) { good = true; } if (n % 47 == 0) { good = true; } if (n % 74 == 0) { good = true; } if (n % 77 == 0) { good = true; } if (n % 444 == 0) { good = true; } if (n % 447 == 0) { good = true; } if (n % 474 == 0) { good = true; } if (n % 477 == 0) { good = true; } if (n % 744 == 0) { good = true; } if (n % 747 == 0) { good = true; } if (n % 774 == 0) { good = true; } if (n % 777 == 0) { good = true; } if (good) { out.println("YES"); } else { out.println("NO"); } } void run() { in = new Scanner(System.in); out = new PrintWriter(System.out); try { solve(); } finally { out.close(); } } public static void main(String[] args) { new n122A().run(); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; public class x { public static void main(String args[]) { Scanner obj=new Scanner(System.in); int n; String d="0"; n=obj.nextInt(); if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%447==0 || n%474==0 || n%747==0) d="YES"; else if(n%444==0 || n%477==0 || n%744==0 || n%774==0 || n%777==0) d="YES"; else d="NO"; System.out.print(d); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; public class Main{ public static void main(String args[]){ Scanner in = new Scanner(System.in); int a[]={4,7,44,47,74,77,444,447,474,477,744,747,774,777}; int n=in.nextInt(); int i=0; boolean yes=false; while((i<14)&&(a[i]<=n)){ if(n%a[i]==0){ System.out.print("YES"); yes=true; break; } i++; } if(!yes) System.out.print("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; /** * Write a description of class lukno here. * * @author (your name) * @version (a version number or a date) */ public class lukno { public static void main (String args[]) { Scanner i= new Scanner(System.in); int n,p; n=i.nextInt(); int t=n; while(n!=0) { p=n%10; if(p!=4||p!=7) { if(t%7==0||t%4==0||t%47==0||t%74==0||t%447==0||t%477==0||t%474==0) System.out.print("YES"); else System.out.print("NO"); break;} else System.out.print("NO"); n=(n/10); } } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.*; import java.util.*; public class Main { StreamTokenizer in; BufferedReader inb; PrintWriter out; public static void main(String[] args) throws Exception { new Main().run(); } public void run() throws Exception { in = new StreamTokenizer(new BufferedReader(new InputStreamReader( System.in))); inb = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(new OutputStreamWriter(System.out)); solve(); out.flush(); } public int nextInt() throws Exception { in.nextToken(); return (int) in.nval; } public int parseInt() throws Exception { return Integer.parseInt(inb.readLine()); } public String nextLine() throws Exception { return inb.readLine(); } public void solve() throws Exception { int n = nextInt(); if ((n%4==0)||(n%44==0)||(n%47==0)||(n%74==0) ||(n%744==0)||(n%747==0)||(n%774==0)||(n%777==0) ||(n%7==0)||(n%444==0)||(n%447==0)||(n%474==0)||(n%477==0)||(n%77==0)) { out.print("YES"); } else { out.print("NO"); } } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class A_122 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(bf.readLine()); System.out.println((n%4==0||n%7==0||n%47==0||n%74==0||n%447==0||n%474==0||n%477==0||n%744==0||n%747==0||n%774==0)?"YES":"NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.*; import java.util.*; public class lucky { public static void main(String args[]) throws IOException { BufferedReader cin=new BufferedReader(new InputStreamReader(System.in)); String s=cin.readLine(); int l=s.length(); int n=Integer.parseInt(s); if(s.equals("47") || s.equals("4") || s.equals("7") || s.equals("74") || s.equals("447") || s.equals("477") || s.equals("474") || s.equals("44") || s.equals("77") || s.equals("444") || s.equals("777") || s.equals("747") || s.equals("774") || s.equals("744")) System.out.println("YES"); else if(n%(47)==0 || n%(4)==0 || n%(7)==0 || n%(74)==0 || n%(447)==0 || n%(477)==0 || n%(474)==0 || n%(44)==0 || n%(77)==0 || n%(444)==0 || n%(777)==0 || n%(747)==0 || n%(774)==0 || n%(744)==0) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; import java.util.StringTokenizer; /** * Created with IntelliJ IDEA. * User: Саша * Date: 08.08.12 * Time: 14:12 */ public class LuckyDivision { public final String check (String s) { String result = "NO"; StringTokenizer stringTokenizer = new StringTokenizer(s, "47"); if(!stringTokenizer.hasMoreTokens()) return "YES"; int S = Integer.parseInt(s); generateSimpleAndDivide(S, 4, 4, 7); generateSimpleAndDivide(S, 7, 4, 7); if(lucky) return "YES"; return result; } public static final void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print(new LuckyDivision().check(scanner.next())); } public void generateSimpleAndDivide(int divided, int n, int n1, int n2) { if(lucky || n >= divided) return; if(divided % n == 0) lucky = true; generateSimpleAndDivide(divided, Integer.parseInt(n + "" + n1), n1, n2); generateSimpleAndDivide(divided, Integer.parseInt(n + "" + n2), n1, n2); } private boolean lucky = false; }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class A_Lucky_Division { public static void main(String[] args){ Scanner input=new Scanner(System.in); int number=input.nextInt(); int flag=0; if(number%4==0)flag=1; else if(number%7==0)flag=1; else if(number%47==0)flag=1; else if(number%74==0)flag=1; else if(number%444==0)flag=1; else if(number%447==0)flag=1; else if(number%474==0)flag=1; else if(number%477==0)flag=1; else if(number%744==0)flag=1; else if(number%747==0)flag=1; else if(number%774==0)flag=1; else if(number%777==0)flag=1; if(flag==1)System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if ((n%4==0)||(n%7==0)||(n%44==0)||(n%47==0)||(n%74==0)||(n%77==0)||(n%444==0)||(n%447==0)||(n%474==0)||(n%477==0)||(n%744==0)||(n%747==0)||(n%774==0)||(n%777==0)) { System.out.println("YES"); } else { System.out.println("NO"); } } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.*; import java.util.*; public class Sol122A { BufferedReader in; StringTokenizer st; PrintWriter out; String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine()); return st.nextToken(); } int nextInt() throws Exception { return Integer.parseInt(next()); } long nextLong() throws Exception { return Long.parseLong(next()); } double nextDouble() throws Exception { return Double.parseDouble(next()); } void solve() throws Exception { long x = nextLong(); out.println((x % 4) * (x % 7) * (x % 74) * (x % 47) * (x % 44) * (x % 77) * (x % 444) * (x % 447) * (x % 474) * (x % 477) * (x % 744) * (x % 747) * (x % 774) * (x % 777) == 0 ? "YES" : "NO"); } void run() { try { Locale.setDefault(Locale.US); in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(new OutputStreamWriter(System.out)); solve(); out.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } public static void main(String[] args) { new Sol122A().run(); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); if (((n % 4) == 0) || ((n % 7) == 0) || ((n % 44) == 0) || ((n % 47) == 0) || ((n % 74) == 0) || ((n % 77) == 0) || ((n % 444) == 0) || ((n % 447) == 0) || ((n % 474) == 0) || ((n % 477) == 0) || ((n % 744) == 0) || ((n % 747) == 0) || ((n % 774) == 0) || ((n % 777) == 0)) System.out.print("YES"); else System.out.print("NO"); in.close(); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.*; import java.util.*; public class solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); boolean ok = (n % 4 == 0) || (n % 7 == 0) || (n % 47 == 0) || (n % 74 == 0) || (n % 447 == 0) || (n % 474 == 0) || (n % 477 == 0) || (n % 744 == 0) || (n % 747 == 0) || (n % 774 == 0); if (ok) System.out.println("YES"); else System.out.println("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; public class Solution { public static void main(String[] args){ Scanner cin=new Scanner(System.in); int n=cin.nextInt(); if(n%4==0 || n%7==0 || n%44==0 || n%47==0 || n%74==0 || n%77==0 || n%444==0 || n%447==0 || n%474==0 || n%477==0 || n%744==0 || n%747==0 || n%774==0 ||n%777==0) System.out.print("YES"); else System.out.print("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.*; public class MainClass { public static void main(String[] args) { Scanner in = new Scanner(System.in); int arr[] = {4,7,47,74,447,474,477,744,747,774}; int i=0, x = in.nextInt(); while (i<arr.length) if (x%arr[i++] == 0) { System.out.print("YES"); return; } System.out.print("NO"); } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class CF { BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st=null; private void solution() throws IOException{ int n=nextInt(); if((n % 4==0 && n>=4)||(n % 7==0 && n>=7) || (n % 44==0 && n>=44) || (n % 47==0 && n>=47) || (n % 77==0 && n>=77) || (n % 74==0 && n>=74) || (n % 444==0 && n>=444) || (n % 447==0 && n>=447) || (n % 474==0 && n>=74) || (n % 477==0 && n>=477) || (n % 744==0 && n>=744) || (n % 747==0 && n>=747) || (n % 777==0 && n>=777)){ System.out.println("YES"); }else{ System.out.println("NO");} } String nextToken()throws IOException { if(st==null || !st.hasMoreTokens()){ st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } public static void main(String args[]) throws IOException { new CF().solution(); } }
constant
122_A. Lucky Division
CODEFORCES
import java.util.Scanner; public class three { static boolean check; public static void main(String[] args) { check = true; Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = n + ""; recurse(n, s.length(), "4"); if (!check) System.out.println("YES"); else { recurse(n, s.length(), "7"); if (!check) System.out.println("YES"); else System.out.println("NO"); } } private static void recurse(int n, int length, String string) { int k = Integer.parseInt(string); if (n % k == 0) { check = false; } else if (string.length() <= length && check) { recurse(n, length, string + "4"); recurse(n, length, string + "7"); } } }
constant
122_A. Lucky Division
CODEFORCES
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in Actual solution is at the top * * @author @Ziklon */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); ABirthday solver = new ABirthday(); solver.solve(1, in, out); out.close(); } static class ABirthday { public void solve(int testNumber, InputReader in, OutputWriter out) { long N = in.readLong(), M = in.readLong(), K = in.readLong(), L = in.readLong(); long ans = ((L + K) - 1) / M + 1; if (ans * M > N || ans * M - K < L) out.printLine(-1); else out.printLine(ans); } } static class OutputWriter { private final PrintWriter writer; public OutputWriter(OutputStream outputStream) { writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter(Writer writer) { this.writer = new PrintWriter(writer); } public void close() { writer.close(); } public void printLine(long i) { writer.println(i); } public void printLine(int i) { writer.println(i); } } static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private InputReader.SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars == -1) { throw new InputMismatchException(); } if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) { return -1; } } return buf[curChar++]; } public long readLong() { int c = read(); while (isSpaceChar(c)) { c = read(); } int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') { throw new InputMismatchException(); } res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public boolean isSpaceChar(int c) { if (filter != null) { return filter.isSpaceChar(c); } return isWhitespace(c); } public static boolean isWhitespace(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
constant
1068_A. Birthday
CODEFORCES
import java.util.*; import java.math.*; import java.io.*; public class CF1068A { public CF1068A() { FS scan = new FS(); long n = scan.nextLong(), m = scan.nextLong(), k = scan.nextLong(), l = scan.nextLong(); long ceil = (k + l + m - 1) / m; if(k + l <= n && ceil * m <= n) System.out.println(ceil); else System.out.println(-1); } class FS { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next() { while(!st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch(Exception e) { e.printStackTrace(); } } return st.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } } public static void main(String[] args) { new CF1068A(); } }
constant
1068_A. Birthday
CODEFORCES
import java.io.*; import java.util.*; public class Codechef{ public static void main(String []args){ Scanner in = new Scanner(System.in); long n=in.nextLong(); long m=in.nextLong(); long k=in.nextLong(); long l=in.nextLong(); long j=((k+l)/m); if((k+l)%m!=0)j++; if((k+l>n) || j*m>n) { System.out.println(-1); }else { System.out.println(j); } } }
constant
1068_A. Birthday
CODEFORCES
import java.util.*; public class Main { static int mod = 1000000007; static int size = 200000; static long[] fac = new long[size]; static long[] finv = new long[size]; static long[] inv = new long[size]; static int INF = Integer.MAX_VALUE; public static void main(String[] args){ Scanner scanner = new Scanner(System.in); String[] s = new String[2]; for(int i = 0; i < 2; i++){ s[i] = scanner.next(); } int n = s[0].length(); char[][] c = new char[2][n]; for(int i = 0; i < 2; i++){ for(int j = 0; j < n; j++){ c[i][j] = s[i].charAt(j); } } int count = 0; for(int i = 0; i < n-1; i++){ if(c[0][i] == '0' && c[1][i] == '0' && c[0][i+1] == '0'){ c[0][i] = 'X'; c[1][i] = 'X'; c[0][i+1] = 'X'; count++; } if(c[0][i] == '0' && c[1][i] == '0' && c[1][i+1] == '0'){ c[0][i] = 'X'; c[1][i] = 'X'; c[1][i+1] = 'X'; count++; } if(c[0][i] == '0' && c[0][i+1] == '0' && c[1][i+1] == '0'){ c[0][i] = 'X'; c[0][i+1] = 'X'; c[1][i+1] = 'X'; count++; } if(c[0][i+1] == '0' && c[1][i+1] == '0' && c[1][i] == '0'){ c[1][i] = 'X'; c[0][i+1] = 'X'; c[1][i+1] = 'X'; count++; } } System.out.println(count); } public static boolean isPrime(int n){ if(n == 1) return false; if(n == 2 || n == 3) return true; for(int i = 2; i <= Math.sqrt(n); i++){ if(n % i == 0) return false; } return true; } // tar の方が数字が大きいかどうか static boolean compare(String tar, String src) { if (src == null) return true; if (src.length() == tar.length()) { int len = tar.length(); for (int i = 0; i < len; i++) { if (src.charAt(i) > tar.charAt(i)) { return false; } else if (src.charAt(i) < tar.charAt(i)) { return true; } } return tar.compareTo(src) > 0 ? true : false; } else if (src.length() < tar.length()) { return true; } else if (src.length() > tar.length()) { return false; } return false; } public static class Edge{ int to; Edge(int to){ this.to = to; } } public static void swap(long a, long b){ long tmp = 0; if(a > b){ tmp = a; a = b; b = tmp; } } static class Pair implements Comparable<Pair>{ int first, second; Pair(int a, int b){ first = a; second = b; } @Override public boolean equals(Object o){ if (this == o) return true; if (!(o instanceof Pair)) return false; Pair p = (Pair) o; return first == p.first && second == p.second; } @Override public int compareTo(Pair p){ return first == p.first ? second - p.second : first - p.first; //firstで昇順にソート //return (first == p.first ? second - p.second : first - p.first) * -1; //firstで降順にソート //return second == p.second ? first - p.first : second - p.second;//secondで昇順にソート //return (second == p.second ? first - p.first : second - p.second)*-1;//secondで降順にソート } } //繰り返し二乗法 public static long pow(long x, long n){ long ans = 1; while(n > 0){ if((n & 1) == 1){ ans = ans * x; ans %= mod; } x = x * x % mod; n >>= 1; } return ans; } public static long div(long x, long y){ return (x*pow(y, mod-2))%mod; } //fac, inv, finvテーブルの初期化、これ使う場合はinitComb()で初期化必要 public static void initComb(){ fac[0] = finv[0] = inv[0] = fac[1] = finv[1] = inv[1] = 1; for (int i = 2; i < size; ++i) { fac[i] = fac[i - 1] * i % mod; inv[i] = mod - (mod / i) * inv[(int) (mod % i)] % mod; finv[i] = finv[i - 1] * inv[i] % mod; } } //nCk % mod public static long comb(int n, int k){ return fac[n] * finv[k] % mod * finv[n - k] % mod; } //n! % mod public static long fact(int n){ return fac[n]; } //(n!)^-1 with % mod public static long finv(int n){ return finv[n]; } static class UnionFind { int[] parent; public UnionFind(int size) { parent = new int[size]; Arrays.fill(parent, -1); } public boolean unite(int x, int y) { x = root(x); y = root(y); if (x != y) { if (parent[y] < parent[x]) { int tmp = y; y = x; x = tmp; } parent[x] += parent[y]; parent[y] = x; return true; } return false; } public boolean same(int x, int y) { return root(x) == root(y); } public int root(int x) { return parent[x] < 0 ? x : (parent[x] = root(parent[x])); } public int size(int x) { return -parent[root(x)]; } } public static int upperBound(int[] array, int value) { int low = 0; int high = array.length; int mid; while( low < high ) { mid = ((high - low) >>> 1) + low; // (high + low) / 2 if( array[mid] <= value ) { low = mid + 1; } else { high = mid; } } return low; } public static final int lowerBound(final int[] arr, final int value) { int low = 0; int high = arr.length; int mid; while (low < high){ mid = ((high - low) >>> 1) + low; //(low + high) / 2 (オーバーフロー対策) if (arr[mid] < value) { low = mid + 1; } else { high = mid; } } return low; } //n,mの最大公約数 public static long gcd(long n, long m){ if(m > n) return gcd(m,n); if(m == 0) return n; return gcd(m, n%m); } //3要素のソート private class Pair2 implements Comparable<Pair2> { String s; int p; int index; public Pair2(String s, int p, int index) { this.s = s; this.p = p; this.index = index; } public int compareTo(Pair2 other) { if (s.equals(other.s)) { return other.p - this.p; } return this.s.compareTo(other.s); } } //c -> intに変換 public static int c2i(char c){ if('A' <= c && c <= 'Z'){ return c - 'A'; }else{ return c - 'a' + 26; } } // int -> charに変換 public static char i2c(int i){ if(0 <= i && i < 26){ return (char)(i + 'A'); }else{ return (char)(i + 'a' - 26); } } }
constant
991_D. Bishwock
CODEFORCES
import java.io.*; import java.util.*; import java.math.*; public class bhaa { InputStream is; PrintWriter o; /////////////////// CODED++ BY++ ++ ++ ++ BHAVYA++ ARORA++ ++ ++ ++ FROM++ JAYPEE++ INSTITUTE++ OF++ INFORMATION++ TECHNOLOGY++ //////////////// ///////////////////////// Make it work, make it right, make it fast. Make it work, make it right, make it fast. Make it work, make it right, make it fast. Make it work, make it right, make it fast. ///////////////// boolean chpr(int n) { if(n==1) { return true; }if(n==2) { return true; } if(n==3) { return true; } if(n%2==0) { return false; } if(n%3==0) { return false; } int w=2; int i=5; while(i*i<=n) { if(n%i==0) { return false; } i+=w; w=6-w; } return true; } void solve() { int n=ni(); int k=ni(); int rr=2*n; int gr=5*n; int br=8*n; o.println((long)(Math.ceil(rr*1.0/k)+Math.ceil(gr*1.0/k)+Math.ceil(br*1.0/k))); } //---------- I/O Template ---------- public static void main(String[] args) { new bhaa().run(); } void run() { is = System.in; o = new PrintWriter(System.out); solve(); o.flush(); } byte input[] = new byte[1024]; int len = 0, ptr = 0; int readByte() { if(ptr >= len) { ptr = 0; try { len = is.read(input); } catch(IOException e) { throw new InputMismatchException(); } if(len <= 0) { return -1; } } return input[ptr++]; } boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); } int skip() { int b = readByte(); while(b != -1 && isSpaceChar(b)) { b = readByte(); } return b; } char nc() { return (char)skip(); } String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } String nLine() { int b = skip(); StringBuilder sb = new StringBuilder(); while( !(isSpaceChar(b) && b != ' ') ) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } int ni() { int n = 0, b = readByte(); boolean minus = false; while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); } if(b == '-') { minus = true; b = readByte(); } if(b == -1) { return -1; } //no input while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); } return minus ? -n : n; } long nl() { long n = 0L; int b = readByte(); boolean minus = false; while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); } if(b == '-') { minus = true; b = readByte(); } while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); } return minus ? -n : n; } double nd() { return Double.parseDouble(ns()); } float nf() { return Float.parseFloat(ns()); } int[] nia(int n) { int a[] = new int[n]; for(int i = 0; i < n; i++) { a[i] = ni(); } return a; } long[] nla(int n) { long a[] = new long[n]; for(int i = 0; i < n; i++) { a[i] = nl(); } return a; } int [][] nim(int n) { int mat[][]=new int[n][n]; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { mat[i][j]=ni(); } } return mat; } long [][] nlm(int n) { long mat[][]=new long[n][n]; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { mat[i][j]=nl(); } } return mat; } char[] ns(int n) { char c[] = new char[n]; int i, b = skip(); for(i = 0; i < n; i++) { if(isSpaceChar(b)) { break; } c[i] = (char)b; b = readByte(); } return i == n ? c : Arrays.copyOf(c,i); } void piarr(int arr[]) { for(int i=0;i<arr.length;i++) { o.print(arr[i]+" "); } o.println(); } void plarr(long arr[]) { for(int i=0;i<arr.length;i++) { o.print(arr[i]+" "); } o.println(); } void pimat(int mat[][]) { for(int i=0;i<mat.length;i++) { for(int j=0;j<mat[0].length;j++) { o.print(mat[i][j]); } o.println(); } } void plmat(long mat[][]) { for(int i=0;i<mat.length;i++) { for(int j=0;j<mat[0].length;j++) { o.print(mat[i][j]); } o.println(); } } //////////////////////////////////// template finished ////////////////////////////////////// }
constant
1080_A. Petya and Origami
CODEFORCES
import java.util.Scanner; public class origami { public static void main(String args[]){ Scanner input = new Scanner(System.in); double n = input.nextInt(); double k = input.nextInt(); double red = 0; double green = 0; double blue = 0; double ans = 0; red = (2 * n) / k; green = (5 * n) / k; blue = (8 * n) / k; double red1 = Math.ceil(red) ; double green1 = Math.ceil(green); double blue1 = Math.ceil(blue); ans+=red1; ans+=green1; ans+=blue1; Double answer = new Double(ans); int finished = answer.intValue(); System.out.println(finished); } }
constant
1080_A. Petya and Origami
CODEFORCES
import java.awt.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.List; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long n = scanner.nextLong(); long x = scanner.nextLong(), y = scanner.nextLong(); long whiteSteps, blackSteps; if(x == 1 || y == 1){ whiteSteps = (x - 1) + (y - 1); } else { whiteSteps = Math.min((x - 1) + Math.abs(y - x), (y - 1) + Math.abs(y - x)); } if(x == n || y == n){ blackSteps = (n - x) + (n - y); } else { blackSteps = Math.min((n - x) + Math.abs(y - x), (n - y) + Math.abs(y - x)); } if (whiteSteps <= blackSteps){ System.out.println("White"); } else { System.out.println("Black"); } } }
constant
1075_A. The King's Race
CODEFORCES
import java.util.Scanner; import javafx.geometry.Point2D; public class ChessKing { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); long size = input.nextLong(); long a = input.nextLong(); long b = input.nextLong(); long sum = a+b; long d = sum-2; long d1 = size*2 - sum; if(d<d1) System.out.println("White"); else if(d>d1) System.out.println("Black"); else System.out.println("White"); } }
constant
1075_A. The King's Race
CODEFORCES
//Author: Patel Rag //Java version "1.8.0_211" import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong(){ return Long.parseLong(next()); } double nextDouble(){ return Double.parseDouble(next()); } float nextFloat() { return Float.parseFloat(next()); } boolean nextBoolean() { return Boolean.parseBoolean(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } static long modExp(long x, long n, long mod) //binary Modular exponentiation { long result = 1; while(n > 0) { if(n % 2 == 1) result = (result%mod * x%mod)%mod; x = (x%mod * x%mod)%mod; n=n/2; } return result; } static long gcd(long a, long b) { if(a==0) return b; return gcd(b%a,a); } public static void main(String[] args) throws IOException { FastReader fr = new FastReader(); long n = fr.nextLong(); long x = fr.nextLong(); long y = fr.nextLong(); long w = Long.min(x,y) - 1 + (x - Long.min(x,y)) + (y - Long.min(x,y)); long b = n - Long.max(x,y) + (Long.max(x,y) - x) + (Long.max(x,y) - y); if(w <= b) System.out.println("White"); else System.out.println("Black"); } } class Pair<U, V> // Pair class { public final U first; // first field of a Pair public final V second; // second field of a Pair private Pair(U first, V second) { this.first = first; this.second = second; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Pair<?, ?> pair = (Pair<?, ?>) o; if (!first.equals(pair.first)) return false; return second.equals(pair.second); } @Override public int hashCode() { return 31 * first.hashCode() + second.hashCode(); } public static <U, V> Pair <U, V> of(U a, V b) { return new Pair<>(a, b); } } class myComp implements Comparator<Pair> { public int compare(Pair a,Pair b) { if(a.first != b.first) return ((int)a.first - (int)b.first); if(a.second != b.second) return ((int)a.second - (int)b.second); return 0; } } class BIT //Binary Indexed Tree aka Fenwick Tree { public long[] m_array; public BIT(long[] dat) { m_array = new long[dat.length + 1]; Arrays.fill(m_array,0); for(int i = 0; i < dat.length; i++) { m_array[i + 1] = dat[i]; } for(int i = 1; i < m_array.length; i++) { int j = i + (i & -i); if(j < m_array.length) { m_array[j] = m_array[j] + m_array[i]; } } } public final long prefix_query(int i) { long result = 0; for(++i; i > 0; i = i - (i & -i)) { result = result + m_array[i]; } return result; } public final long range_query(int fro, int to) { if(fro == 0) { return prefix_query(to); } else { return (prefix_query(to) - prefix_query(fro - 1)); } } public void update(int i, long add) { for(++i; i < m_array.length; i = i + (i & -i)) { m_array[i] = m_array[i] + add; } } }
constant
1075_A. The King's Race
CODEFORCES
import java .util.*; import java .io.*; public class Main{ public static void main(String[]YAHIA_MOSTAFA){ Scanner sc =new Scanner(System.in); long n=sc.nextLong(),x=sc.nextLong(),y=sc.nextLong(); long xb,xw,yb,yw; xw=x-1;yw=y-1;xb=n-x;yb=n-y; if (x==n&&y==n){ System.out.println("Black");return; } long c1=0,c2=0; long f =Math.max(xb,yb); long h =Math.max(xw,yw); //System.out.println(h+" "+f+" "+(h-f)); if (h<=f) System.out.println("White"); else System.out.println("Black"); } }
constant
1075_A. The King's Race
CODEFORCES
import java.util.*; public class Pizza { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long num = sc.nextLong() + 1; sc.close(); System.out.println(num % 2 == 0 || num == 1 ? num / 2 : num); } }
constant
979_A. Pizza, Pizza, Pizza!!!
CODEFORCES
import java.util.*; public class A { public static void main(String args[]) { Scanner sc=new Scanner(System.in); long n=sc.nextLong(); if(n==0) System.out.println(0); else if(n%2==1) System.out.println((n+1)/2); else System.out.println(n+1); } }
constant
979_A. Pizza, Pizza, Pizza!!!
CODEFORCES
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long k = sc.nextLong(); System.out.println(solve(n, k)); sc.close(); } static long solve(long n, long k) { return Math.max(0, Math.min(n, k - 1) - ((k + 2) / 2) + 1); } }
constant
1023_B. Pair of Toys
CODEFORCES
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here long n,s,p; Scanner in=new Scanner(System.in); n=in.nextLong(); s=in.nextLong(); if(n==1 && s<=1) { System.out.print(n-1); } else if(s<n) { if(s%2!=0) {System.out.print(s/2);} else {System.out.print(s/2-1);} } else if(s==n) { if(s%2==0) {System.out.println((n/2)-1);} else {System.out.println(n/2);} } else if(s<=(2*n-1)) { System.out.print((2*n+1-s)/2); } else { System.out.print(0); } } }
constant
1023_B. Pair of Toys
CODEFORCES
import java.util.*; import java.io.*; public class Soldiers { public static void main(String[] args) throws IOException { new Soldiers().run(); } void run() throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(System.out); int n = nextInt(); pw.println(3 * (n / 2)); pw.close(); } BufferedReader br; StringTokenizer st; PrintWriter pw; String next() throws IOException { while (st == null || !st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } int nextInt() throws IOException { return Integer.parseInt(next()); } double nextDouble() throws IOException { return Double.parseDouble(next()); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String args[]) throws Exception { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); int num=Integer.parseInt(in.readLine()); System.out.println((num/2)*(3)); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.PrintWriter; import java.util.Scanner; public class Solution { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n=in.nextInt(); out.print(n/2+n); out.close(); in.close(); } }
constant
84_A. Toy Army
CODEFORCES
public class A { public static void main(String[] args) { System.out.println(new java.util.Scanner(System.in).nextInt() / 2 * 3); } }
constant
84_A. Toy Army
CODEFORCES
//package Codeforces72; import java.util.Scanner; public class A { /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); System.out.println((int)(n+n/2)); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.*; import java.io.*; public class C72A{ static BufferedReader br; public static void main(String args[])throws Exception{ br=new BufferedReader(new InputStreamReader(System.in)); long n=toLong(); long res=n+n/2; System.out.println(res); } /****************************************************************/ public static int[] toIntArray()throws Exception{ String str[]=br.readLine().split(" "); int k[]=new int[str.length]; for(int i=0;i<str.length;i++){ k[i]=Integer.parseInt(str[i]); } return k; } public static int toInt()throws Exception{ return Integer.parseInt(br.readLine()); } public static long[] toLongArray()throws Exception{ String str[]=br.readLine().split(" "); long k[]=new long[str.length]; for(int i=0;i<str.length;i++){ k[i]=Long.parseLong(str[i]); } return k; } public static long toLong()throws Exception{ return Long.parseLong(br.readLine()); } public static double[] toDoubleArray()throws Exception{ String str[]=br.readLine().split(" "); double k[]=new double[str.length]; for(int i=0;i<str.length;i++){ k[i]=Double.parseDouble(str[i]); } return k; } public static double toDouble()throws Exception{ return Double.parseDouble(br.readLine()); } public static String toStr()throws Exception{ return br.readLine(); } public static String[] toStrArray()throws Exception{ String str[]=br.readLine().split(" "); return str; } /****************************************************************/ }
constant
84_A. Toy Army
CODEFORCES
import java.io.*; import java.util.*; import java.math.BigInteger; public class Main implements Runnable { private final String problemname = ""; private final String FILE_IN = problemname + ".in"; private final String FILE_OUT = problemname + ".out"; public void run() { // in = new BufferedReader(new FileReader(FILE_IN)); // out = new PrintWriter(FILE_OUT); in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); _st = new StringTokenizer(""); // TODO: type your code here int n = nextInt(); int best = n + n / 2; /* for (int i = 0; i <= n; i++) { for (int j = 0; j <= n - i; j++) { best = Math.max(best, i + j + Math.min(n - i, n - j)); } }*/ out.println(best); try { in.close(); out.close(); } catch (Exception e) { System.err.println("Epic fail"); } } BufferedReader in; PrintWriter out; StringTokenizer _st; public static void main(String[] args) { new Thread(new Main()).start(); } private void seek() { while (!_st.hasMoreTokens()) { String s; try { s = in.readLine(); _st = new StringTokenizer(s); } catch (Exception e) { return; } } } private String next() { seek(); return _st.nextToken(); } private int nextInt() { return Integer.parseInt(next()); } private long nextLong() { return Long.parseLong(next()); } private double nextDouble() { return Double.parseDouble(next()); } private BigInteger nextBigInteger() { return new BigInteger(next()); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import java.text.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T =sc.nextInt(); int t =T/2; System.out.println(t*3); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.Scanner; public class ToyArmy { public static void main(String[] args) { int n = new Scanner(System.in).nextInt(); System.out.println(n + n / 2); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { private BufferedReader input; private PrintWriter output; private StringTokenizer stoken; String fin = "input"; String fout = "output"; private void solve() { long a = nextInt(); long res = (a / 2) * 3; output.print(res); } Main() throws IOException { //input = new BufferedReader(new FileReader(fin + ".txt")); //output = new PrintWriter(new FileWriter(fout + ".txt")); input = new BufferedReader(new InputStreamReader(System.in)); output = new PrintWriter(System.out); solve(); input.close(); output.flush(); output.close(); } int nextInt() { return Integer.parseInt(nextToken()); } long nextLong() { return Long.parseLong(nextToken()); } double nextFloat() { return Float.parseFloat(nextToken()); } double nextDouble() { return Double.parseDouble(nextToken()); } String nextToken() { while ((stoken == null) || (!stoken.hasMoreTokens())) { try { String line = input.readLine(); stoken = new StringTokenizer(line); } catch (IOException e) { e.printStackTrace(); } } return stoken.nextToken(); } public static void main(String[] args) throws IOException { new Main(); } } class Tarif { public int abPlata; public int tMin; public int price; public long res; }
constant
84_A. Toy Army
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class A { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader r=new BufferedReader(new InputStreamReader(System.in)); String s=r.readLine(); int n=Integer.parseInt(s); System.out.println(n*3/2); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.*; public class A72 { public static void main (String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); System.out.println(n * 3 / 2); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.Scanner; public class ToyArmy { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); System.out.println(n / 2 + n); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.*; import java.io.*; public class A { public static void main(String[] args) { Kattio io = new Kattio(System.in); int n = io.getInt(); int ans = 0; int V = n; int A = n; A -= n/2; ans += n/2; V -= A; ans += A; A -= n/2; ans += n/2; io.println(ans); io.flush(); } } class Kattio extends PrintWriter { public Kattio(InputStream i) { super(new BufferedOutputStream(System.out)); r = new BufferedReader(new InputStreamReader(i)); } public Kattio(InputStream i, OutputStream o) { super(new BufferedOutputStream(o)); r = new BufferedReader(new InputStreamReader(i)); } public boolean hasMoreTokens() { return peekToken() != null; } public int getInt() { return Integer.parseInt(nextToken()); } public double getDouble() { return Double.parseDouble(nextToken()); } public long getLong() { return Long.parseLong(nextToken()); } public String getWord() { return nextToken(); } private BufferedReader r; private String line; private StringTokenizer st; private String token; private String peekToken() { if (token == null) try { while (st == null || !st.hasMoreTokens()) { line = r.readLine(); if (line == null) return null; st = new StringTokenizer(line); } token = st.nextToken(); } catch (IOException e) { } return token; } private String nextToken() { String ans = peekToken(); token = null; return ans; } }
constant
84_A. Toy Army
CODEFORCES
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int in = sc.nextInt(); System.out.println(in/2 + in); System.exit(0); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; import java.util.StringTokenizer; public class CF { public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n=sc.nextInt(); pw.print(n+n/2); pw.close(); sc.close(); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); System.out.println(3 * (n / 2)); } }
constant
84_A. Toy Army
CODEFORCES
import java.math.BigInteger; import java.util.*; /** * Created by IntelliJ IDEA. * User: piyushd * Date: 4/13/11 * Time: 8:07 PM * To change this template use File | Settings | File Templates. */ public class TaskA1 { void run(){ int n = nextInt(); int ans = 2 * n - (n / 2); System.out.println(ans); } int nextInt(){ try{ int c = System.in.read(); if(c == -1) return c; while(c != '-' && (c < '0' || '9' < c)){ c = System.in.read(); if(c == -1) return c; } if(c == '-') return -nextInt(); int res = 0; do{ res *= 10; res += c - '0'; c = System.in.read(); }while('0' <= c && c <= '9'); return res; }catch(Exception e){ return -1; } } long nextLong(){ try{ int c = System.in.read(); if(c == -1) return -1; while(c != '-' && (c < '0' || '9' < c)){ c = System.in.read(); if(c == -1) return -1; } if(c == '-') return -nextLong(); long res = 0; do{ res *= 10; res += c-'0'; c = System.in.read(); }while('0' <= c && c <= '9'); return res; }catch(Exception e){ return -1; } } double nextDouble(){ return Double.parseDouble(next()); } String next(){ try{ StringBuilder res = new StringBuilder(""); int c = System.in.read(); while(Character.isWhitespace(c)) c = System.in.read(); do{ res.append((char)c); }while(!Character.isWhitespace(c=System.in.read())); return res.toString(); }catch(Exception e){ return null; } } String nextLine(){ try{ StringBuilder res = new StringBuilder(""); int c = System.in.read(); while(c == '\r' || c == '\n') c = System.in.read(); do{ res.append((char)c); c = System.in.read(); }while(c != '\r' && c != '\n'); return res.toString(); }catch(Exception e){ return null; } } public static void main(String[] args){ new TaskA1().run(); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.PrintStream; import java.util.Scanner; public class Cfbra { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintStream out = System.out; out.println(in.nextInt() / 2 * 3); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); System.out.println(3 * n / 2); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; public class Govnokod { public static void main(String args[]) { try { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); while (true) { String str = br.readLine(); int i = Integer.parseInt(str); System.out.println(i*2-i/2); return; } } catch (Exception e) { e.printStackTrace(); } } }
constant
84_A. Toy Army
CODEFORCES
import java.io.*; public class N72A { StreamTokenizer in; PrintWriter out; int nextInt() throws IOException { in.nextToken(); return (int) in.nval; } double nextDouble() throws IOException { in.nextToken(); return in.nval; } public void init() throws Exception { boolean oj = System.getProperty("ONLINE_JUDGE") != null; Reader reader = oj ? new InputStreamReader(System.in) : new FileReader(new File("input.txt")); Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter(new File("output.txt")); in = new StreamTokenizer(reader); out = new PrintWriter(writer); } public void solve() throws Exception { int n = nextInt(); out.print(2*n - (n/2)); } public void print() throws Exception { out.flush(); } public void run() throws Exception { init(); solve(); print(); } public static void main(String[] args) throws Exception { new N72A().run(); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.Scanner; public class MainA { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int count = 0; count = n/2; count = count + (n - n/2); n = n - n/2; count = count + n; System.out.println(count); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.Scanner; public class Task1 { public static void main(String[] args) { int n = new Scanner(System.in).nextInt(); System.out.println(n*3/2); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; public class TemplateBuf implements Runnable{ private void solve() throws Exception { long n = nextUnsignedLong(); out.println(n+n/2); } ///////////////////////////////////////////////// BufferedReader in; PrintWriter out; @Override public void run() { try{ in = new BufferedReader(new InputStreamReader(System.in), INPUT_BUF_SIZE); out = new PrintWriter(new OutputStreamWriter(System.out)); solve(); out.flush(); }catch (Exception e) { e.printStackTrace(); System.exit(1); } } final int INPUT_BUF_SIZE = 1024 * 8; final int BUF_SIZE = INPUT_BUF_SIZE; char[] buf = new char[BUF_SIZE]; int ch=-1; int charRead=-1; int charPos=-1; public char nextChar() throws IOException{ if (charPos<0 || charPos>=charRead){ charRead = in.read(buf); charPos=0; } return buf[charPos++]; } public long nextUnsignedLong() throws IOException{ while ((ch=nextChar())<'0' || ch>'9'); long num = ch-'0'; while ((ch=nextChar())>='0' && ch<='9'){ num*=10; num+=ch-'0'; } return num; } public int nextUnsignedInt() throws IOException{ return (int)nextUnsignedLong(); } public double nextDouble() throws IOException{ while (((ch=nextChar())<'0' || ch>'9') && ch!='.' && ch!='-'); char[] tmp = new char[255]; int itmp = 0; tmp[itmp++]=(char)ch; while (((ch=nextChar())>='0' && ch<='9') || ch=='.' || ch=='-'){ tmp[itmp++]=(char)ch; } return Double.parseDouble(new String(tmp,0,itmp)); } public static void main(String[] args) { new TemplateBuf().run(); } }
constant
84_A. Toy Army
CODEFORCES
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class ProblemA_72 { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); void init() throws FileNotFoundException{ if (ONLINE_JUDGE){ in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); }else{ in = new BufferedReader(new FileReader("input.txt")); out = new PrintWriter("output.txt"); } } String readString() throws IOException{ while(!tok.hasMoreTokens()){ tok = new StringTokenizer(in.readLine()); } return tok.nextToken(); } int readInt() throws IOException{ return Integer.parseInt(readString()); } public static void main(String[] args){ new ProblemA_72().run(); } public void run(){ try{ long t1 = System.currentTimeMillis(); init(); solve(); out.close(); long t2 = System.currentTimeMillis(); System.err.println("Time = "+(t2-t1)); }catch (Exception e){ e.printStackTrace(System.err); System.exit(-1); } } void solve() throws IOException{ int n = readInt(); out.print((n + n/2)); } static class MyAlgo{ long gcd(long a, long b){ if (a == 0) return b; return gcd(b % a, a); } long lcm(long a, long b){ return a / gcd(a, b)*b; } long[] gcdPlus(long a, long b){ long[] d = new long[3]; if (a == 0){ d[0] = b; d[1] = 0; d[2] = 1; }else{ d = gcdPlus(b % a, a); long r = d[1]; d[1] = d[2] - b/a*d[1]; d[2] = r; } return d; } long binpow(long a, int n){ if (n == 0) return 1; if ((n & 1) == 0){ long b = binpow(a, n/2); return b*b; }else return binpow(a, n-1)*a; } long binpowmod(long a, int n, int m){ if (n == 0) return 1; if ((n & 1) == 0){ long b = binpow(a, n/2); return (b*b) % m; }else return binpow(a, n-1)*a % m; } long f(long n, int x, int k){ //Кол-во десятичных чисел (включая 0), содержащих в себе цифры от 0 до k-1 if (n == 0) return 1; long b = binpow(10, x - 1); long c = n / b; return (c < k? c: k)*binpow(k, x - 1) + (c < k? 1: 0)*f(n % b, x - 1, k); } long fib(int n){ if (n == 0) return 0; if ((n & 1) == 0){ long f1 = fib(n/2 - 1); long f2 = fib(n/2 + 1); return f2*f2 - f1*f1; }else{ long f1 = fib(n/2); long f2 = fib(n/2 + 1); return f1*f1 + f2*f2; } } BigInteger BigFib(int n){ if (n == 0) return BigInteger.ZERO; if ((n & 1) == 0){ BigInteger f1 = BigFib(n/2 - 1); f1 = f1.multiply(f1); BigInteger f2 = BigFib(n/2 + 1); f2 = f2.multiply(f2); return f2.subtract(f1); }else{ BigInteger f1 = BigFib(n/2); f1 = f1.multiply(f1); BigInteger f2 = BigFib(n/2 + 1); f2 = f2.multiply(f2); return f2.add(f1); } } boolean IsProbablyPrime(long n){ if (n == 1) return false; if ((n & 1) == 0) return false; for (int j = 3; j < sqrt(n) + 1; j += 2){ if (n % j == 0) return false; } return true; } int[] Sieve(int n){ boolean[] b = new boolean[n+1]; Arrays.fill(b, true); b[0] = false; b[1] = false; long nLong = n; int j=0; for (int i = 1; i <= n; i++) { if (b[i]){ j++; if (((long)i)*i <= nLong) { for (int k = i*i; k <= n; k += i) { b[k] = false; } } } } int[] p = new int[j]; Arrays.fill(p, 0); j=0; for (int i = 2; i <= n; i++) { if (b[i]){ p[j]=i; j++; } } return p; } public class Permutation { int[] a; int n; public Permutation(int n){ this.n=n; a=new int[n]; for (int i=0; i<n; i++){ a[i]=i; } } public boolean nextPermutation(){ //Пишется с do{}while(nextPermutation(a)); int i=n-1; for (i=n-2; i>=0; i--){ if (a[i]<a[i+1]){ break; } } if (i==-1){ return false; } int jMin=i+1; for (int j=n-1; j>i; j--){ if (a[i]<a[j]&&a[j]<a[jMin]){ jMin=j; } } swap(i, jMin); for (int j=1; j<=(n-i)/2; j++){ swap(i+j, n-j); } return true; } public int get(int i){ return a[i]; } void swap(int i, int j){ int r=a[i]; a[i]=a[j]; a[j]=r; } } public class Fraction implements Comparable<Fraction>, Cloneable{ public final Fraction FRACTION_ZERO = new Fraction(); public final Fraction FRACTION_ONE = new Fraction(1); public long numerator = 0; public long denominator = 1; public Fraction(){ numerator = 0; denominator = 1; } public Fraction(long numerator){ this.numerator = numerator; denominator = 1; } public Fraction(long numerator, long denominator){ this.numerator = numerator; this.denominator = denominator; Cancellation(); } public Fraction(double numerator, double denominator, int accuracy){ this.numerator = (long)(numerator*pow(10,accuracy)); this.denominator = (long)(denominator*pow(10,accuracy)); Cancellation(); } public Fraction(String s){ if (s.charAt(0) == '-'){ denominator = -1; s = s.substring(1); } if (s.indexOf("/") != -1){ denominator *= Integer.parseInt(s.substring(s.indexOf("/") + 1)); } if (s.indexOf(" ") != -1){ numerator = Integer.parseInt(s.substring(0, s.indexOf(" "))) * abs(denominator) + Integer.parseInt(s.substring(s.indexOf(" ") + 1, s.indexOf("/"))); }else{ if (s.indexOf("/") != -1){ numerator = Integer.parseInt(s.substring(0, s.indexOf("/"))); }else{ numerator = Integer.parseInt(s)*abs(denominator); } } this.Cancellation(); } void Cancellation(){ long g = gcd(abs(numerator), abs(denominator)); numerator /= g; denominator /= g; if (denominator < 0){ numerator *= -1; denominator *= -1; } } public String toString(){ String s = ""; if (numerator == 0){ return "0"; } if (numerator < 0){ s += "-"; } if (abs(numerator) >= denominator){ s += Long.toString(abs(numerator) / denominator) + " "; } if (abs(numerator) % denominator != 0){ s += Long.toString(abs(numerator) % denominator); }else{ s = s.substring(0, s.length()-1); } if (denominator != 1){ s += "/" + Long.toString(denominator); } return s; } public Fraction add(Fraction f){ Fraction fResult = new Fraction(); fResult.denominator = lcm(denominator, f.denominator); fResult.numerator = numerator * fResult.denominator / denominator + f.numerator * fResult.denominator / f.denominator; fResult.Cancellation(); return fResult; } public Fraction subtract(Fraction f){ Fraction fResult = new Fraction(); fResult.denominator = lcm(denominator, f.denominator); fResult.numerator = numerator * fResult.denominator / denominator - f.numerator * fResult.denominator / f.denominator; fResult.Cancellation(); return fResult; } public Fraction multiply(Fraction f){ Fraction fResult = new Fraction(); fResult.numerator = numerator * f.numerator; fResult.denominator = denominator * f.denominator; fResult.Cancellation(); return fResult; } public Fraction divide(Fraction f){ Fraction fResult = new Fraction(); fResult.numerator = numerator * f.denominator; fResult.denominator = denominator * f.numerator; fResult.Cancellation(); return fResult; } @Override public int compareTo(Fraction f){ long g = gcd(denominator, f.denominator); long res = numerator * (f.denominator / g) - f.numerator * (denominator / g); if (res < 0){ return -1; } if (res > 0){ return 1; } return 0; } public Fraction clone(){ Fraction fResult = new Fraction(numerator, denominator); return fResult; } public Fraction floor(){ Fraction fResult = this.clone(); fResult.numerator = (fResult.numerator / fResult.denominator) * fResult.denominator; return fResult; } public Fraction ceil(){ Fraction fResult = this.clone(); fResult.numerator = (fResult.numerator/fResult.denominator + 1) * fResult.denominator; return fResult; } public Fraction binpow(int n){ if (n==0) return FRACTION_ONE; if ((n&1)==0){ Fraction f=this.binpow(n/2); return f.multiply(f); }else return binpow(n-1).multiply(this); } } class FenwickTree_1{ //One-dimensional array int n; long[] t; public FenwickTree_1(int n){ this.n = n; t = new long[n]; } public long sum(int xl, int xr){ return sum(xr) - sum(xl); } public long sum(int x){ long result = 0; for (int i = x; i >= 0; i = (i & (i + 1)) - 1){ result += t[i]; } return result; } public void update(int x, long delta){ for (int i = x; i < n; i = (i | (i + 1))){ t[i] += delta; } } } class FenwickTree_2{ //Two-dimensional array int n, m; long[][] t; public FenwickTree_2(int n, int m){ this.n = n; this.m = m; t = new long[n][m]; } public long sum(int xl, int yl, int xr, int yr){ return sum(xr, yr) - sum(xl - 1, yr) - sum(xr, yl - 1) + sum(xl - 1, yl - 1); } public long sum(int x, int y){ long result = 0; for (int i = x; i >= 0; i = (i & (i + 1)) - 1){ for (int j = y; j >= 0; j = (j & (j + 1)) - 1){ result+=t[i][j]; } } return result; } public void update(int x, int y, long delta){ for (int i = x; i < n; i = (i | (i + 1))){ for (int j = y; j < m; j = (j | (j + 1))){ t[i][j] += delta; } } } } class FenwickTree_3{ //Three-dimensional array int n, m, l; long[][][] t; public FenwickTree_3(int n, int m, int l){ this.n = n; this.m = m; this.l = l; t = new long[n][m][l]; } public long sum(int xl, int yl, int zl, int xr, int yr, int zr){ return sum(xr, yr, zr) - sum(xl - 1, yr, zr) + sum(xl - 1, yr, zl - 1) - sum(xr, yr, zl - 1) - sum(xr, yl - 1, zr) + sum(xl - 1, yl - 1, zr) - sum(xl - 1, yl - 1, zl - 1) + sum(xr, yl - 1, zl - 1); } public long sum(int x, int y, int z){ long result = 0; for (int i = x; i >= 0; i = (i & (i + 1)) - 1){ for (int j = y; j >= 0; j = (j & (j + 1)) - 1){ for (int k = z; k >= 0; k = (k & (k + 1)) - 1){ result += t[i][j][k]; } } } return result; } public void update(int x, int y, int z, long delta){ for (int i = x; i < n; i = (i | (i + 1))){ for (int j = y; j < n; j = (j | (j + 1))){ for (int k = z; k < n; k = (k | (k + 1))){ t[i][j][k] += delta; } } } } } } }
constant
84_A. Toy Army
CODEFORCES
import java.util.Scanner; /** * Created by IntelliJ IDEA. * User: Administrator * Date: 13.05.11 * Time: 23:21 * To change this template use File | Settings | File Templates. */ public class ToyArmies { public static void main(String[] args) { Scanner in = new Scanner(System.in); long n = in.nextLong(); System.out.print(String.format("%d",(long)(n*1.5))); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.*; import java.util.*; import java.math.*; public class A { private void solve() throws IOException { int n = nextInt(); int r = n; n *= 2; n -= (0.5*r); System.out.println(n); } public static void main(String[] args) { new A().run(); } BufferedReader reader; StringTokenizer tokenizer; PrintWriter writer; public void run() { try { reader = new BufferedReader(new InputStreamReader(System.in)); tokenizer = null; writer = new PrintWriter(System.out); solve(); reader.close(); writer.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } int[] readIntArray(int size) throws IOException { int[] res = new int[size]; for (int i = 0; i < size; i++) { res[i] = nextInt(); } return res; } long[] readLongArray(int size) throws IOException { long[] res = new long[size]; for (int i = 0; i < size; i++) { res[i] = nextLong(); } return res; } double[] readDoubleArray(int size) throws IOException { double[] res = new double[size]; for (int i = 0; i < size; i++) { res[i] = nextDouble(); } return res; } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } BigInteger nextBigInteger() throws IOException { return new BigInteger(nextToken()); } String nextToken() throws IOException { while (tokenizer == null || !tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(reader.readLine()); } return tokenizer.nextToken(); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.IOException; import java.util.Locale; import java.util.Scanner; public class A { private void processInput() throws IOException { Scanner in = new Scanner(System.in); int n = in.nextInt(); long res = go(n); System.out.printf(Locale.ENGLISH, "%d\n", res); in.close(); } private long go(long n) { long res = 3*n / 2; return res; } public static void main(String[] args) throws Exception { A a = new A(); a.processInput(); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.*; import java.util.*; import static java.lang.Math.*; public class BetaRound72_Div2_A implements Runnable { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); void init() throws IOException { if (ONLINE_JUDGE) { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); } else { in = new BufferedReader(new FileReader("input.txt")); out = new PrintWriter("output.txt"); } } String readString() throws IOException { while (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); } return tok.nextToken(); } int readInt() throws IOException { return Integer.parseInt(readString()); } @Override public void run() { try { long t1 = System.currentTimeMillis(); init(); Locale.setDefault(Locale.US); solve(); out.close(); long t2 = System.currentTimeMillis(); System.err.println("Time = " + (t2 - t1)); } catch (Exception e) { e.printStackTrace(System.err); System.exit(-1); } } public static void main(String[] args) { new Thread(new BetaRound72_Div2_A()).start(); } void solve() throws IOException { int n = readInt(); int ans = n * 3 / 2; out.print(ans); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.StringTokenizer; /** * @author abashkin */ public class Solution implements Runnable { public static void main(String[] args) { new Thread(new Solution()).start(); } public void run() { try{ br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(new OutputStreamWriter(System.out)); solve(); pw.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } private void solve() throws Exception { int n = nextInt(); pw.print(n + n / 2); } private BufferedReader br; private PrintWriter pw; private StringTokenizer tok; private String next() throws Exception { while (tok == null || !tok.hasMoreElements()) tok = new StringTokenizer(br.readLine()); return tok.nextToken(); } private int nextInt() throws Exception { return Integer.parseInt(next()); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.*; import java.util.*; public class Main { public void solve() throws IOException { int n = nextInt(); output.println(n / 2 * 3); } public void run() throws IOException { input = new BufferedReader(new InputStreamReader(System.in)); output = new PrintWriter(System.out); solve(); input.close(); output.close(); } BufferedReader input; PrintWriter output; StringTokenizer tok; String nextToken() throws IOException { while(tok == null || !tok.hasMoreTokens()) tok = new StringTokenizer(input.readLine()); return tok.nextToken(); } int nextInt() throws IOException { return Integer.valueOf(nextToken()); } long nextLong() throws IOException { return Long.valueOf(nextToken()); } double nextDouble() throws IOException { return Double.valueOf(nextToken()); } public static void main(String[] args) throws IOException { new Main().run(); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); System.out.println(n/2*3); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.*; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int n = read.nextInt(); System.out.println(n*3/2); } }
constant
84_A. Toy Army
CODEFORCES
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); System.out.println(n + n / 2); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.*; import java.util.*; public class Main { StreamTokenizer in; PrintWriter out; public static void main(String[] args) throws Exception { new Main().run(); } public void run() throws Exception { in = new StreamTokenizer (new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(new OutputStreamWriter(System.out)); solve(); out.flush(); } int nextInt() throws Exception { in.nextToken(); return (int) in.nval; } public void solve() throws Exception { int n=nextInt(); long ans=0; for (int i=0;i<n;i+=2) ans+=3; out.println(ans); } }
constant
84_A. Toy Army
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; public class A { private static StreamTokenizer in; private static PrintWriter out; private static int nextInt() throws Exception{ in.nextToken(); return (int)in.nval; } private static String nextString() throws Exception{ in.nextToken(); return in.sval; } static{ in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); } public static void main(String[] args)throws Exception{ int n = nextInt(); out.println(n*3/2); out.flush(); } }
constant
84_A. Toy Army
CODEFORCES