Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.*; /** * Ashesh Vidyut (Drift King) * */ public class C { public static void main(String[] args) { try { BufferedReader in = new BufferedReader(n...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
from sys import stdin,stdout,setrecursionlimit,maxint,exit #setrecursionlimit(2*10**5) def listInput(): return map(long,stdin.readline().split()) def printBS(li): for i in xrange(len(li)-1): stdout.write("%d "%li[i]) stdout.write("%d\n"%li[-1]) from math import ceil def sin(): return stdin.readline().rstrip() n=i...
PYTHON
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, i, flag, piles, till_now; int arr[100]; cin >> n; for (i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); flag = 1; piles = 0; while (flag != 0) { flag = 0; till_now = 0; for (i = 0; i < n; i++) { if (arr[i]...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
N = int(raw_input()) A = map(int,raw_input().split()) A.sort() for k in xrange(1,N+1): flag = 0 for i in xrange(N): if A[i] < (i/k): flag=1 break if flag==0: break print k
PYTHON
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; const long long MXN = 1e6 + 1; const long long MNN = 1e3 + 1; const long long MOD = 1e9 + 7; const long long INF = 1e18; const long long MAGIC = 1000; const long double EPS = 1e-9; const long double PI = 3.1415926536; const string TIME = "rovno_ushten_push_ketti"; long long...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.util.*; import java.io.*; public class a { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(); int[] a = new int[n]; for(int i = 0; i<n; i++) a[i] = input.nextInt(); Arrays.sor...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import sys, math def rs(): return sys.stdin.readline().strip() def ri(): return int(sys.stdin.readline().strip()) def ras(): return list(sys.stdin.readline().strip()) def rai(): return map(int,sys.stdin.readline().strip().split()) def raf(): return map(float,sys.stdin.readline().strip().split()) ...
PYTHON
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int main(void) { int arr[100], sum; int pile = 1; scanf("%d", &sum); for (int i = 0; i < sum; i++) scanf("%d", &arr[i]); sort(arr, arr + sum); int count = 0; for (int i = 0; i < sum; i++) { if (i / pile > arr[i]) { pile++; } else { count++;...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; public class C { static int compute(int[] s) { Arrays.sort(s); int ts=0, ret=0, j=0; for (int i=s.length-1; i>=0; i--) { ...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int e[100 + 1]; int main() { int n; cin >> n; int a[n + 1]; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); int cnt = 0; for (int i = 1; i <= n; i++) { if (e[i] == 1) continue; int dem = 1; for (int j = i + 1; j <= n; j++) i...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
n = int(input()) arr = list(map(int, input().split())) arr.sort() res = 1 for i in range(n): if arr[i] < i // res: res += 1 print(res)
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
n = int(input()) l = [int(x) for x in input().split()] ans = 0 l.sort() while(l): l1 = [] c = 0 for i in range(len(l)): if (l[i]>=c): c+=1 else: l1.append(l[i]) l = l1[:] ans+=1 print(ans)
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.util.Arrays; import java.util.Scanner; public class me { public static void main(String[] args) { Scanner br = new Scanner(System.in); int n = br.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; ++i) { arr[i] = br.nextInt(); } Arrays...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { ...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.util.*; import java.io.*; //DONT FORGET TO CHANGE CLASS NAME! public class FoxBox { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); StringTokenizer st=new StringTokenizer(sc.nextLine()); int numBoxes=Integer.parseInt(st.nextToken(...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#Python 2.7 """ Sort the array, into ascending Then simply place it in a stack if possible, or make a new one (ie do it in reverse with the least strongest first. """ numStacks = 0 n = input() boxes = raw_input().split() boxes = [int(x) for x in boxes] boxes.sort() #print boxes #array of stacks stackArray = ...
PYTHON
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; const int MOD = (int)(1e9) + 7; map<int, int> M; set<int> S; int n, a[123], b[123][123], c[123], ans, ma; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; b[c[a[i]]][a[i]] = 1; c[a[i]]++; } for (int j = 1; j <= 100; j++) for (int i =...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.InputStream; ...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
def check(a,x): for i in range(len(a)): if a[i] < len(a) - i: return False return True n=int(input()) a=list(map(int,input().split())) a=sorted(a) piles = [] for i in a: if len(piles) == 0: piles.append([i]) else: flg=1 for j in range(len(piles)): if len(piles[j])<=i: piles[j].append(i) f...
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.util.*; import java.io.*; import java.math.*; public class Practice { static FastReader sc=new FastReader(); public static void main(String[] args) { int ttt =1; //ttt=i(); int mod=(int)Math.pow(10, 9)+7; PrintWriter out = new PrintWriter(System.out); ...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; vector<pair<string, bool>> dict; int main() { int N; vector<pair<int, bool>> arr; cin >> N; for (int i = 0; i < N; i++) { int q = 0; cin >> q; arr.push_back(make_pair(q, false)); } sort(arr.begin(), arr.end()); int res = 0; for (int i = 0; i < N;...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
numberofboxes = int(raw_input()) boxes = list(map(int,raw_input().split(" "))) boxes.sort() stacklist = [0] for i in boxes: for j in range(len(stacklist)): if i >= stacklist[j]: stacklist[j] += 1 break else: stacklist.append(1) print len(stacklist)
PYTHON
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int a[101]; vector<int> anda; int main() { int n; cin >> n; int ans = 0; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); for (int i = 1; i <= n; i++) { std::vector<int>::iterator up; sort(anda.begin(), anda.end()); up = std::upper_b...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int n, a[101], cnt, now, p, rst, x, ans = 0, nn; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%d", &a[i]); sort(a + 1, a + 1 + n); rst = n; while (rst > 0) { now = 1; x = a[1]; a[1] = 101; nn = rst; --rst; for (int i = ...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
from collections import Counter n=input() x=map(int,raw_input().split()) c=Counter(x) def dfs(d): for k in c: if k>=d: c[k]-=1 if c[k]==0: del c[k] dfs(d+1) break cnt=0 while len(c): dfs(0) cnt+=1 print cnt
PYTHON
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.util.*; import java.io.*; import java.math.BigInteger; public class Main { static final int mod = (int)1e9+7; static int N = 101; public static void main(String[] args) throws Exception { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int main(int argc, char** argv) { int N; cin >> N; vector<int> vec(N); for (int i = 0; i < N; i++) cin >> vec[i]; sort(vec.begin(), vec.end()); vector<int> H; vector<int> L; L.push_back(vec[0]); H.push_back(1); for (int i = 1; i < N; i++) { int curr ...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int x[105], n, wtf[105], ans; int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", &x[i]); sort(x, x + n); ans = 0; for (int i = 0; i < n; ++i) { bool br = false; for (int j = 0; j < ans; ++j) if (wtf[j] <= x[i]) { ++wtf[j]; ...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int a[(110)]; int n; int b[(110)][(110)]; int pan(int x) { memset(b, 0, sizeof(b)); for (int i = n, j = 1; i > 0; --i, j = j % x + 1) b[j][++b[j][0]] = a[i]; for (int i = 1; i <= x; ++i) for (int j = 1; j <= b[i][0]; ++j) if (b[i][j] < b[i][0] - j) return 0;...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; const int maxn = 222222, inf = ~0U >> 1; int A[maxn], n, m, cur[maxn]; bool ok(int num) { memset(cur, (0), sizeof(cur)); for (int i = 0; i < n; i++) { int x = A[i]; int no = 0; for (int j = 0; j < num; j++) if (cur[j] <= x && cur[j] >= cur[no]) no = j;...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int a[105], x[105]; int main() { int n, i, cn = 0, j, w, wn, ck; scanf("%d", &n); memset(a, 0, sizeof a); for (i = 0; i < n; i++) { scanf("%d", &w); a[w]++; } while (1) { wn = 0; ck = 0; for (i = 0; i < 101; i++) { while (a[i] && i >= w...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
n=int(input()) arr=[int(i) for i in input().split()] arr.sort() for i in range(1,n+1): temp=[] l=n-1 for j in range(i): temp.append(arr[l]) l-=1 boo=True while(l>=0 and boo): boo=False for j in range(i): if temp[j]>0: boo=True ...
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.util.Arrays; import java.util.Scanner; public class FoxAndBoxAccumaltion { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); ...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
n, required, searched = int(input()), 0, [] boxes = list(sorted([int(i) for i in input().split()])) while True: stack = 0 for i in range(n): if i not in searched and boxes[i] >= stack: searched.append(i) stack += 1 if stack: required += 1 else: bre...
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; bool R[107]; int ar[107]; int find(int val, int pos, int n) { for (int i = pos; i < n; i++) if (ar[i] >= val and !R[i]) return i; return n; } int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> ar[i]; sort(ar, ar + n); bool did = true; int r...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
from collections import deque def getLine(): return list(map(int,input().split())) n = int(input()) arr = getLine() arr.sort() d = deque() d.append(arr[0]) l = [d] for i in range(1,len(arr)): found = False for d in l: if len(d) <= arr[i]: found=True d.append(arr[i]) ...
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, x; cin >> n; priority_queue<int, vector<int>, greater<int> > Q; for (int i = 0; i < n; i++) { cin >> x; Q.push(x); } int ans = 0; auto V = vector<int>(); int cnt = 0, t; while (n) { t = Q.top()...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int n, m, a[1005], p[1005]; int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", a + i); sort(a, a + n); for (int i = 0; i < n; ++i) { int w = -1; for (int j = 0; j < m; ++j) if (p[j] <= a[i]) { ++p[j], w = j; break; ...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int n, a[101]; bool vis[101]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int sum = 0; int t = n; int flag = 0; while (t) { flag = 0; for (int i = 0; i < n; i++) { if (flag <= a[i] && !vis[i]) { vis[i] ...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws IOException { InputReader in = new InputReader(); int n = in.nextInt(); int[] a = new int[n]; f...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; template <typename T> string NumberToString(T Number) { ostringstream ss; ss << Number; return ss.str(); } template <typename T> T StringToNumber(const string &Text) { istringstream ss(Text); T result; return ss >> result ? result : 0; } int v[100]; int main() {...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.util.*; public class FoxAndBoxAccumulation { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] boxes = new int[n]; for(int x = 0; x < n; x++) { boxes[x] = in.nextInt(); } Arrays.sort(boxes); outer: for(int y = 1; y <...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.util.Arrays; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] v = new int[n]; boolean[] f = new boolean[n]; for (int i = 0; i < n; i++) v[i] = in.nextInt(); Arrays.sort(v); in...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, t, m = 0; cin >> n; vector<int> s; for (int i = 0; i < n; i++) { cin >> t; s.push_back(t); } sort(s.begin(), s.end()); while (true) { t = -1; for (int i = 0; i < n; i++) { if (s[i] !...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.lang.reflect.Array; import java.util.*; import java.io.*; import java.math.*; import java.lang.*; /** * Created by vishakha on 07-11-2016. */ public class Problem { public static void main(String[] args) { FastReader1 sc = new FastReader1(System.in); int n = sc.nextInt(); Arr...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int n, a[105]; bool ok(int k) { for (int i = 1; i <= n; ++i) if ((i - 1) / k > a[i]) return false; return true; } int main() { cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; sort(a + 1, a + n + 1); for (int i = 1; i <= n; ++i) if (ok(i)) { cou...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.io.*; import java.util.*; public class Test{ static final int p = 1000000007; public static void main(String [] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); StringTokenizer st = ne...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.math.BigInteger; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String args[]) { Scann...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.StringTokenizer; public class C { static class Scanner{ BufferedReader br=null; StringTokenizer tk=null; public Sca...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> t(n); bool c[n]; for (int i = 0; i < n; i++) { cin >> t[i]; c[i] = true; } sort(t.begin(), t.end()); int cnt = 0, ans = 0; while (cnt != n) { int cie = 0; for (int i = 0; i < n; i++) { if (c[i...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#double underscore makes a class variable or a class method private mod = 1000000007 ii = lambda : int(input()) si = lambda : input() dgl = lambda : list(map(int, input())) f = lambda : map(int, input().split()) il = lambda : list(map(int, input().split())) ls = lambda : list(input()) n = ii() l = il() vis=[0]*n l.sort...
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:36777216") using namespace std; template <class T> inline T &RD(T &); template <class T> inline void OT(const T &); inline long long RD() { long long x; return RD(x); } inline double &RF(double &); inline double RF() { double x; return RF(x); } inline cha...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
from itertools import * n = int(raw_input()) x = map(int, raw_input().split()) d = {} for e in x: if e not in d: d[e] = 0 d[e]+=1 k = max(d.values()) x = sorted(x, reverse=True) for p in xrange(1,k+1): bins = [200 for _ in xrange(p)] for e in x: _,i = max(zip(bins,xrange(p)), key=lambda a: a[0]) ...
PYTHON
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
n = int(raw_input()) r = list(sorted(int(c) for c in raw_input().split())) piles = [0] * 100 np = 0 for i in r: for j in xrange(100): if piles[j] > i: continue piles[j] += 1 np = max(np,j+1) break print np
PYTHON
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); int a[110]; int main() { int i, N, x; cin >> N; for (i = 0; i < N; i++) { cin >> x; ++a[x]; } int ans, p, need; for (ans = 0;; ++ans) { for (p = 0; p <= 100; p++) if (a[p]) break; if (p > 100) break; p = 0;...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; const int co = 1000; int a[co + 10]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", a + i); sort(a, a + n); int used = 0, ans = 0; while (used < n) { ans++; int h = 0; for (int i = 0; i < n; i++) if (a[i] >= h) { ...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int b[103]; int w[103] = {0}; int ans = 1; int bb[103]; int main() { int n, i, j; cin >> n; for (i = 1; i <= n; i++) cin >> b[i]; for (i = 1; i <= n; i++) bb[i] = -1; sort(b + 1, b + 1 + n); for (i = 1; i <= n; i++) { for (j = 1;; j++) { if (b[i] >= bb...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; int c = 0, z = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); for (int i = 0; i < n; i++) { if (c * (arr[i] + 1) <= i) c++; } cout << c << endl; return 0; }
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.io.*; import java.util.*; public class C { static BufferedReader stdin = new BufferedReader(new InputStreamReader( System.in)); static StringTokenizer st = new StringTokenizer(""); public static void main(String[] args) throws Exception { int n = readInt(); int[] w ...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
var num = parseInt(readline()); var arr = readline().split(" "); var map = {}; var col = 0; var cols = []; for(var i in arr) { arr[i] = parseInt(arr[i]); } arr.sort(unSort); for(var i in arr) { var value = arr[i], isNew = true ; for(var j in cols) { if (cols[j].length <= valu...
JAVA
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
n=input() arr=map(int,raw_input().split()) arr=sorted(arr) an=[1] for i in range(1,len(arr)): a=arr[i] found=False for j in range(len(an)): b=an[j] if b<=a: an[j]+=1 found=True break if found==False: an.append(1) an=sorted(an,reverse=True) ...
PYTHON
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
def solve(): n = input() L = sorted(map(int, raw_input().split())) for i in range(1, n + 1): pile = [0] * i ind = 0 for j in range(n): if pile[ind % i] <= L[j]: pile[ind % i] += 1 ind += 1 else: break els...
PYTHON
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
from sys import stdin,stdout nmbr=lambda:int(stdin.readline()) lst = lambda: list(map(int,input().split())) for _ in range(1):#nmbr()): n=nmbr() a=sorted(lst()) ans=0 while 1: left=[] cap=0 for v in a: if v>=cap: cap+=1 else:left+=[v] ...
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
def input_int_array(): return [int(string) for string in input().split()] # input part n = input_int_array()[0] boxes = input_int_array() counts = [0]*101 for hardess in boxes: counts[hardess] += 1 # bingo columns = [] for hardness in range(0, 101) : if counts[hardness] <= 0 : continue ...
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; map<int, int> cnt; vector<int> ara; int main() { int n, x, ans = 0; cin >> n; for (int i = 0; i < (n); i++) { cin >> x; ara.push_back(x); } sort(ara.begin(), ara.end()); for (int i = 0; i < (ara.size()); i++) { x = ara[i]; cnt[x] = i + 1; x =...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
n = int(input()) a = list(map(int,input().split())) r = 0 flags = [False]*n a.sort() count = 0 for i in range(n): if(count==n): break r+=1 last = -1 for j in range(n): if(flags[j]): continue if(a[j]==last): continue flags[j] = True count+=1 last+=1 print(r)
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
n=int(input()) a=list(map(int,input().split())) sm=1 b=[0 for i in range(101)] for i in range(n): b[a[i]]+=1 x=[0]*n z=0 zm=0 for i in range(101): while b[i]!=0: if x[z]>i: z+=1 zm=max(zm,z) if x[z]<=i and b[i]>0: x[z]+=1 b[i]-=1 z=0 pr...
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5, M = 1e9 + 7; int main() { ios ::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<int> a; for (int i = 1; i <= n; ++i) { int x; cin >> x; a.push_back(x); } int ret = 0; while (!a.empty()) { ++ret; vector<int...
CPP
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
n = int( input() ) a = sorted( list( map( int, input().split() ) ) ) used = [False]*(n+1) ans = 0 while True: pos = -1 for i in range( n ): if used[i] == False: pos = i break if pos == -1: break ans += 1 total = 1 used[pos] = True for j in range(...
PYTHON3
389_C. Fox and Box Accumulation
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl...
2
9
import java.util.*; import java.io.*; public class Codeforces { static int arr[]; static boolean used[]; public static void main(String[] args) throws IOException { Reader.init(System.in); int n = Reader.nextInt(); arr = new int[n]; used = new boolean[n]; for (in...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
i = [0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2 ] print(i[input()...
PYTHON
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
oes=[ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1,2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2] value = int(raw_in...
PYTHON
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int s[65] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2,...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static ...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> int a[1020] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
print([0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2,1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5,1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1][int(input())])
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int n; int main() { cin >> n; switch (n) { case 0: cout << "0"; break; case 1: cout << "1"; break; case 2: cout << "1"; break; case 3: cout << "1"; break; case 4: cout << "2"; break; cas...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int main() { int num[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1,...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include<iostream> a = [0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, ...
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class F { public static void main(String[] args) throws IOException { FastScanner scan = new FastScanner(); PrintWriter out = new PrintWriter(System.ou...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> const int a[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
a = [ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2] n = input...
PYTHON
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int main() { int a[105] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
a=[0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2,1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5,1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1,2,1,12,1,10,1,4,2] n=int(input()) print(a[n])
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; const double PI = 3.14159; int main() { ios::sync_with_stdio(false); int a[64] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52,...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
import java.util.*; public class f { public static void main(String[] args) { Scanner input = new Scanner(System.in); int[] res = new int[]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, ...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
import java.math.BigInteger; import java.io.BufferedWriter; import java.io.File; import java.io.PrintWriter; import java.util.Scanner; // yeah another submission for this problem public class Main { private void solve() throws Exception { int groupsOfOrderN[] = { 0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1,...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int a[64] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267}; int main...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
print[0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2,1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5,1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1,2,1,12,1,10,1,4,2][input()]
PYTHON
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int main() { int a[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
a=[0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2,1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5,1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1,2,1,12,1,10,1,4,2] b=int(input()) print(a[b])
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
n = int(input()) res=[0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2]...
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int ans[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
lst = [ 0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2] print lst[in...
PYTHON
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> int a[100] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 2...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
import math print[0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2,1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5,1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1,2,1,12,1,10,1,4,2][input()]
PYTHON
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
OeisA000001 = [0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2] print(...
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> int n, a[110] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
var a = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2,1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267]; var n = readline(); print(a[n-1]);
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≀ a ≀ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
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 r217_b { static StringTokenizer st; static BufferedReader br; static PrintWriter ...
JAVA