Programming Challenge -PKU-内検索 / 「2782 Bin Packing」で検索した結果

検索 :
  • 2782 Bin Packing
    2782 Bin Packing 解答例 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int b = sc.nextInt(); int[] ls = new int[n]; for(int i=0;i n;i++) ls[i] = sc.nextInt(); Arrays.sort(ls); int inf = 0; int sup = n-1; int cnt = 0...
  • 全掲載問題リスト
    ... Numbers 2782 Bin Packing 2800 Joseph s Problem
  • 2227 The Wedding Juicer
    2227 The Wedding Juicer 解答例 import java.util.*; public class Main { static final int MAX = 1000000000; public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int w = sc.nextInt(); int h = sc.nextInt(); int[][] b = new int[h+2][w+2]; int[...
  • 1017 Packets
    1017 Packets 解答例 import java.util.*; public class Main { public static void main(String args[]){ Scanner sc = new Scanner(System.in); while(true){ int p1 = sc.nextInt(); int p2 = sc.nextInt(); int p3 = sc.nextInt(); int p4 = sc.nextInt(); int p5 = sc.nextInt(); int p6 = sc.nextInt(); if (p1 + p...
  • 1273 Drainage Ditches
    1273 Drainage Ditches 解答例 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = sc.nextInt(); int m = sc.nextInt(); int[][] network = new int[m][m]; for(int i=0;i m;i++) Arrays.fill(network[i], 0); for(int i=0;i n...
  • 1845 Sumdiv
    1845 Sumdiv 問題 http //acm.pku.edu.cn/JudgeOnline/problem?id=1845 解答方針 いくつかの数学的事実を用いる. p1^r1 p2^r2 ... pn^rn の約数の和は (1 + p1 + ... + p1^r1)(1 + p2 + ... + p2^r2) ... (1 + pn + ... + pn^rn) とかける. フェルマーの小定理により a^(p-1) = 1 (mod p) がなりたつ. さらに, 1 + a + a^2 + ... + a^(p-2) = | when a = 0 then 1 | when a = 1 then p-1 | otherwise then 0 (mod p) がなりたつ. 解答例 import java...
  • 1482 It's not a Bug, It's a Feature!
    1482 It s not a Bug, It s a Feature! 解答例 import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int cnt = 0; while(true){ int n = sc.nextInt(); int m = sc.nextInt(); if(n==0 m==0) break; cnt++; ...
  • 2042 Lagranges Four-Square Theorem
    2042 Lagranges Four-Square Theorem 問題 http //acm.pku.edu.cn/JudgeOnline/problem?id=2042 解答方針 問題自体は単純ですが,時間が非常に厳しいです.平方数および二つの平方数の和で表せる数をあらかじめHashSetに登録しておくことで高速化しています. 解答例 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Solver sol = new Solver(); while(true){ int n = sc.nextInt(); ...
  • 2769 Reduced ID Numbers
    2769 Reduced ID Numbers 解答例 import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=0;i n;i++){ int g = sc.nextInt(); int a[] = new int[g]; for(int j=0;j g;j++){ a[j] = sc.nextInt();...
  • 2739 Sum of Consecutive Prime Numbers
    2739 Sum of Consecutive Prime Numbers 解答例 import java.util.*; public class Main { static final int SIZE = 2000; static int[] primetable; public static void main(String[] args) { //make prime number table makePrimeTable(); //scanner Scanner sc = new Scanner(System.in); //solve int x; while((x = sc.nextInt())!=0){...
  • 2147 Dice Puzzle
    2147 Dice Puzzle 解答例 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int s=0;s n;s++){ int top[][] = new int[3][3]; int front[][] = new int[3][3]; for(int i=0;i 3;i++){ for(int j=0;j 3;j++){ top[i][j] = ...
  • @wiki全体から「2782 Bin Packing」で調べる

更新順にページ一覧表示 | 作成順にページ一覧表示 | ページ名順にページ一覧表示 | wiki内検索

ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。