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
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import sys inputNum = int(input()) outputString = "" isFirst = True while inputNum > 0: combineTier = 1 combineValue = 1 while inputNum >= combineValue: combineTier = combineTier + 1 combineValue = combineValue * 2 combineTier = combineTier - 1 combineValue = combineValue / 2 inp...
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; stack<int> a; for (int i = 0; i < n; i++) { a.push(1); bool can = true; while (can) { can = false; int x = a.top(); a.pop(); if (!a.empty()) { int y = a.top(); a.pop(); if (x =...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; const long long INF = 1e12; const int MAXN = 1e8 + 2, MODM = 1e9 + 7, P = 1e6 + 3, MULT1 = 30, MULT2 = 239, LUCKY = 13, ELEVEN = 11, MAXM = 101; const unsigned long long C = 18446744073709551615; vector<int> k; vector<int> w; long long len = 0; long long mas[11]; ...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.*; import java.util.*; public class a { public static void main(String[] args) throws IOException { Scanner2 input = new Scanner2(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(); ArrayDeque<Integer> d = new ArrayDeque<Integer>(); for(int i = 0; i<n; i++) { d...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; bitset<50> q; int main(int argc, char** argv) { long n; cin >> n; q = n; bool isFirst = false; for (int i = 50; i >= 0; i--) { if (q[i] != 0) { isFirst = true; } if (q[i] != 0 && isFirst) { cout << i + 1 << " "; } } return 0; }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = int(input()) bindigits = [] start = 0 while n>0: bindigits.insert(0,n%2) n = n // 2 start += 1 for bit in bindigits: if bit == 1: print(start, end = ' ') start -= 1
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; void wwin() { cout << "YES\n"; } void fail() { cout << "NO\n"; } void ex() { exit(0); } vector<int> ans; int main() { int n; cin >> n; for (int i = 0; i < 31; i++) { if ((1 << i) & n) ans.push_back(i + 1); } for (int i = ans.size() - 1...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const int MOD = 1e9 + 7; const int N = 1e5 + 10; int s[N]; int main() { int n, top = 0; cin >> n; for (auto i = (1); i <= (n); i++) { s[++top] = 1; while (top > 1 && s[top] == s[top - 1]) s[--top]++; } for (auto i = (1); i <= (top); i+...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { for (int i = 25; i >= 0; --i) { if (n >> i & 1) cout << i + 1 << ' '; } cout << endl; } return 0; }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.StringTokenizer; import java.lang.StringBuilder; import java.lang.Math; import java.util.HashSet; import java.util.Arrays; public class Main{ public static void main(String[] args) throws IOException{ Buffe...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Problem_0618A { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = Integer.valueOf(input.nextLine()); List<Integer> res = new ArrayList<>(); int two = 1;...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
//package codeforce; import java.util.ArrayList; import java.util.Iterator; import java.util.Scanner; /* @author Kbk*/ public class SliceCombining { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt();//Get The No.Of Slimes //StringBuilder slime=n...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class SlimeCombining { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String s = Integer.toBinaryStr...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.*; import java.util.*; public class Main { static StringBuilder data = new StringBuilder(); final static FastReader in = new FastReader(); public static void main(String[] args) { int n = in.nextInt(); int s = 1; ArrayList<Integer> a = new ArrayList<>(); w...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int n, i, counter; vector<int> slimes; int insert_or_sum(int number) { if (!slimes.empty() && slimes.back() == number) { slimes.pop_back(); return insert_or_sum(++number); } else if (slimes.empty() || slimes.back() != number) { slimes.push_back(number); ...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
def main(): n, res, mask, x = int(input()), [], 1, 1 while n >= mask: if n & mask: res.append(x) mask *= 2 x += 1 print(*[x for x in reversed(res) if x]) if __name__ == '__main__': main()
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
a=bin(int(input()))[:1:-1] b=[i+1 for i in range(len(a))if a[i]=='1'] print(' '.join(map(str,b[::-1])))
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> row; for (int used = n; used != 0; used--) { row.push_back(1); if (row.back() != row[(row.size()) - 2]) { continue; } else { while (row.back() == row[(row.size()) - 2]) { row[(row.size()) - 2]...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = input() K = bin(n)[2:] A = [] for l in range(len(K)): if K[l] == '1': A.append(len(K)-l) for l in A: print l,
PYTHON
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
x=int(input()) a=[1] for i in range(x-1): if a[len(a)-1]==1: a[len(a)-1]+=1 while len(a)>1 and a[len(a)-1]==a[len(a)-2]: a.pop() a[len(a)-1]+=1 else: a.append(1) for i in a: print(i)
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
x = input() l = [] for i in range(x): l.append(1) if len(l)>1: while l[-1]==l[-2]: x = l[-1]+1 l = l[:-2] l.append(x) if len(l)==1: break for i in range(len(l)): print l[i],
PYTHON
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 1000; long long int mn = N, ans1, n, m, h, k, x, ans, cnt, fin; long long int a[N]; long long int b[N]; long long int c[N]; string s[9]; vector<int> v; pair<long long int, long long int> p[N]; int main() { ios::sync_with_stdio(false), cin.tie(0), cout....
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
//package solution; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokeni...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = int(input()) window = [] while n > 0: window.append(1) n -= 1 while len(window) > 1 and window[-1] == window[-2]: window[-2] += 1 window.pop() print(' '.join(map(str, window)))
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
def solve(l): if(len(l)>1 ): if(l[-1]==l[-2]): a=l[-1] l.pop() l.pop() l.append(a+1) if(len(l)!=len(set(l))): l=solve(l) return l else: return l n=int(input()) l=[] for i in range(n): l.append(1) if(len(l)!=len(set(l))): l=solve(l) print(*l)
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n=int(input()) for i in range(20,-1,-1): if 2**i<=n: print(i+1,end=" ") n-=2**i
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
# import sys # sys.stdin=open("input.in",'r') # sys.stdout=open("out.out",'w') n=int(input()) x=bin(n) x=x[2:] x=x[::-1] a=[] l=len(x) for i in range(l): if x[i]=="1": a.append(i+1) a=a[::-1] print(*a,sep=" ")
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
from collections import deque n = int(input()) data = deque([1]) while n > 1: data.append(1) n -= 1 while len(data) > 1 and data[-1] == data[-2]: help = data[-1] + 1 data.pop() data.pop() data.append(help) print(*list(data))
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int main() { long a, temp, counter = 0; cin >> a; temp = floor(log2(a)); for (long i = temp; i >= 0; i--) if (a & (1 << i)) cout << i + 1 << ' '; return 0; }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
# Description of the problem can be found at http://codeforces.com/problemset/problem/618/A # in: list of values in non-descending order, the value to search for # the first index to check between and the last index to check to # out: one index of value if it exists. If it does not, return -1 # From: My Common Pyt...
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 123; const int MINN = 1e3 + 123; const int mod = 1e9 + 7; const int INF = 1e9 + 1; long long tol[MAXN]; int main() { long long n, cur = 0; cin >> n; while (n) { n--; tol[++cur] = 1; if (tol[cur] == tol[cur - 1]) { tol[cur] = -1...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); int x = n, y; vector<int> ans; while (x != 0) { y = log2(x); ans.push_back(y + 1); x = x - pow(2, y); } for (auto v : ans) { printf("%d ", v); } return 0; }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL); std::stack<int> g; int n, b = 1; bool first = false; std::cin >> n; while (n >= 1) { if (n % 2 == 1) g.push(b); n /= 2; b++; } while (!g.empty()) { if (!first) ...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.util.Scanner; import java.util.Stack; public class TestA { public void solve(Scanner in) { int n = in.nextInt(); Stack<Integer> stack = new Stack<Integer>(); stack.push(1); n=n-1; while(n>0){ int p; int x = 1; while(!stack.i...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import sys import math def good(n): while n%2==0: n/=2 if n==1: return True else : return False arr={1:[1],} t=2 while t<100005: arr[t]=[] if good(t): arr[t]=[int(math.log2(t))+1] else: tmp=2**(int(math.log2(t))) arr[t]=arr[tmp]+arr[t-tmp] t=t+1 # for line in sys.stdin: # n=line.split() # a=int(...
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n=int(raw_input()) if n==1: print 1 exit() p=[1] for i in xrange(1, n): p.append(1) if True: f=0 if len(p)==1: break while p[len(p)-1]==p[len(p)-2]: p[len(p)-2]+=1 del p[len(p)-1] if len(p)==1: f=1 br...
PYTHON
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.IOException; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int n = in.nextInt(); List<Integer> s = new ArrayList<>(); s.add(1); for (int i = 1; i < n; ++i) { ...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = int(input()) a = [] for i in range(1,n+1): a.append(1) while(len(a) > 1 and a[-1] == a[-2]): v = a.pop() a.pop() a.append(v+1) for i in a: print(i,end = " ")
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; vector<int> line; for (int i = 0; i < a; i++) { line.push_back(1); A: if (line.size() >= 2) { if (line[line.size() - 1] == line[line.size() - 2]) { line.pop_back(); line.push_back(line[line.size() - 1] + ...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int p = 0; while (n > 0) { p = 0; while (pow(2, p) <= n) p++; p--; cout << p + 1 << ' '; n -= pow(2, p); } cout << '\n'; return 0; }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
slimes = int(input()) array = list() counter = 0 while slimes: array.append(1) slimes -= 1 counter2 = len(array)-1 while counter2 > 0: if (counter2-1) < 0: break if array[counter2] == array[counter2-1]: del array[counter2] array[counter2-1] += 1 ...
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = int(input()) curr = [-7] for i in range(n): curr.append(1) while curr[-1] == curr[-2]: curr[-2] += 1 curr.pop() print(' '.join(map(str, curr[1:])))
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int v[100005]; int main() { int n, quad = 1, i = 1, ind; scanf("%d", &n); while (quad <= 100000) { v[i] = quad; i++, quad *= 2; } v[i] = 100005; while (n > 0) { ind = lower_bound(v + 1, v + i + 1, n) - v; if (n == 1) { n -= v[ind]; pr...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Vector; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { static class Task { public void solve(InputReader in, Pri...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import math def bigest(x): return int(math.log(x,2)) n= int(raw_input()) while n>0: c = bigest(n) print c+1, n-= 2**c print
PYTHON
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 19; i > -1; --i) if (n & (1 << i)) cout << i + 1 << ' '; }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#n=100 n=input("") m=n counter = -1 total=0 while total!=n: while (2**counter)<=m: counter+=1 pov = counter-1 print pov+1 total = total + 2**pov m=n-total counter=0
PYTHON
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import math def solve(): n = int(input()) for i in range(100, -1, -1): if n & 2 ** i: print(i + 1, end = " ") print() t = 1 # t = int(input()) while True: solve() t -= 1 if t <= 0: break
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
def main(): from math import log2, floor n = int(input()) result = [] while n > 0: x = floor(log2(n)) result += [str(x + 1)] n -= 2 ** x print(' '.join(result)) if __name__ == '__main__': main()
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = input() nn = bin(n)[:1:-1] result = [] for i in xrange(len(nn)): if nn[i] == '1': result.append(i+1) print ' '.join(map(str,result[::-1]))
PYTHON
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; long long int a[1000005], po[100]; long long int por(long long int p) { long long int i, j; i = 1; j = 1; while (i <= p) { i = i * 2; j++; } i = i / 2; return i; } int main() { long long int i, j, k, m, n, p; for (i = 0; i <= 18; i++) { k = pow...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int x, y, z, a, b, c = 0, i = 0, arr[100000] = {0}; string s, d; bool flag = true; bool test(int x) { c = 0; while (x > 1) { x /= 2; c++; } arr[i] = c + 1; if (y == powl(2, c)) { return true; } i++; return false; } int main() { cin >> x; y = ...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = int(input()) for i in range(20, -1, -1): if n >= 2**i: print(i+1, end=" ") n -= 2**i
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import math n = int(input()) ans = [x+1 for x in range(n.bit_length(), -1, -1) if (n>>x)&1] for x in ans: print(x, end = ' ')
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
print(*[i+1 for i,x in enumerate(bin(int(input()))[2:][::-1])if x>'0'][::-1])
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n=int(input()) a,d=[n%2],n//2 while d>0: a.insert(0,d%2) d=d//2 l=len(a) for x in range(l): if a[x]==1:print(l-x,end=" ")
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:67108864") using namespace std; int main() { int n; cin >> n; for (int i = 20; i >= 0; --i) if (n & (1 << i)) cout << i + 1 << " "; cout << endl; return 0; }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.util.*; import java.io.*; public class CF618A{ // http://codeforces.com/contests/618/A public static int index; public static void main(String[] args)throws IOException, Exception { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(Syste...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> int n; int log(int x, int sayac) { if (x < 2) { return sayac; } return log(x / 2, sayac + 1); ; } int fpow(int a, int b) { if (b == 0) return 1; int x = fpow(a, b / 2); x = x * x; if (b % 2) x = x * a; return x; } int main() { scanf("%d", &n); while (1) { if (n == ...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); int n; cin >> n; vector<int> a; for (int i = 0; i < n; i++) { a.push_back(1); while (a.size() >= 2 && a[a.size() - 2] == a.back()) { a.pop_back(); a.back()++; } } for (int x...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.*; import java.util.*; public class SolveA { BufferedReader br; StringTokenizer in; PrintWriter out; public String nextToken() throws IOException { while (in == null || !in.hasMoreTokens()) { in = new StringTokenizer(br.readLine()); } return in.nextToken(); } public int nextInt() throws...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int nob(int n) { int ans = 0; while (n > 0) { ans++; n = n / 2; } return ans; } int main() { int n; cin >> n; while (n) { cout << nob(n) << " "; n = n % (1 << (nob(n) - 1)); } }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.*; import java.util.Stack; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws FileNotFoundException { InputStream inputStream = System.in; OutputStream outputStream = System.out; // InputStream inputStream = new FileInputStream("input.txt"); ...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; const int M = 1e6 + 15; const int Q = 1e9 + 7; int g[M], r; int main() { srand(time(NULL)); int n; cin >> n; for (int i = 0; i < n; i++) { g[r++] = 1; while (r > 1 && g[r - 1] == g[r - 2]) { g[r - 2]++; r--; } } for (int i = 0; i < r; i++...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> int main() { int i, n; scanf("%d", &n); for (i = 20; i >= 0; i--) if (n >> i & 1) printf("%d ", i + 1); }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
def main_function(): n = int(input()) slimes = [] for i in range(n): slimes.append(str(1)) for k in range(len(slimes) - 1): if int(slimes[-1]) == int(slimes[-2]): slimes.pop() slimes[-1] = str(int(slimes[-1]) + 1) else: ...
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = int(raw_input()) arr = [] for _ in xrange(n): arr.append(1) while True: try: arr[-2] except IndexError: break i = arr.pop() j = arr.pop() if i == j: arr.append(i + 1) else: arr.append(j) arr.append(i) break print ' '.join(map(str, arr))
PYTHON
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> int main() { int n; std::cin >> n; std::vector<int> v; int r = 1; while (n != 0) { if (n % 2) v.push_back(r); r++; n = n / 2; } for (int i = v.size() - 1; i >= 0; --i) { std::cout << v[i]; if (i) std::cout << ' '; } return 0; }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n=int(input()) l=[1] for i in range(2,n+1): l.append(1) while l[-1]==l[-2]: p=l.pop() l.pop() l.append(p+1) if len(l)==1: break for i in l: print(i,end=' ')
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
s = bin(int(input()))[2:] for i,j in enumerate(s): if j=='1':print(len(s)-i)
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = int(raw_input()) print " ".join(str(i+1) for i in range(20,-1,-1) if (n&(1<<i)) > 0)
PYTHON
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = input() pow2 = [(1<<i) for i in xrange(25)] op = [] while n != 0: prev = 1 for p in pow2: if n >= prev and n < p: break prev = p n -= prev op.append(bin(prev)[2:].count('0') + 1) for v in op: print v,
PYTHON
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
A = [i for i, ch in enumerate(reversed(bin(int(input()))), 1) if ch == '1'] print(*reversed(A))
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class WFA { public static void main(String[] args) throws IOException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); Pr...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); while (n > 0) { printf("%d ", (int)log2(n) + 1); n -= pow(2, (int)log2(n)); } }
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
l = [0] + list(reversed(bin(int(input())))) for i in range(len(l)-2,0,-1): if l[i] == '1': print(i,end=' ')
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.util.*; import java.io.*; import java.math.*; import java.awt.geom.*; public class SlimeCombine{ public static void main(String[] args) { MyScanner sc=new MyScanner(); String s=(new StringBuilder(Integer.toBinaryString(sc.ni()))).reverse().toString(); for(int i=s.length()-1;i>=0;i--) ...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.lang.*; import java.io.*; import java.util.*; public class Combining { public static void main(String[] args) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWrite...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
num = int(input()) ans = [] while num: ans.append(1) while len(ans) > 1 and ans[-1] == ans[-2]: x = ans.pop() + 1 ans[-1] = x num -= 1 print(*ans)
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> const int N = 1000 * 1000; int szt = 0; int l[N]; inline void add() { l[szt] = 1; szt++; while (szt > 1) { if (l[szt - 1] == l[szt - 2]) { szt--; l[szt - 1]++; } else { break; } } } int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { ...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; int n; vector<int> res; void input() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; } void output() { ios::sync_with_stdio(false); cin.tie(0); for (int i = 0; i < res.size(); ++i) cout << res[i] << ' '; } void solver() { int tmp = 1, tmp2 = 1; while (t...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = bin(int(input()))[2:] l = len(n) for i in n: if i=='1': print(l, end = ' ') l-=1
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.util.*; public class ProA { static int n; public static void main(String[] args) { Scanner in=new Scanner(System.in); n=in.nextInt(); for(int i=20;i>=0;i--) if((n&(1<<i))>0) System.out.print((i+1)+" "); } }
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
def deep(n): if n != 0: i = 0 while n > 2**i: i += 1 if n == 2**i: print(i+1) else: print(i, end=' ') n -= 2**(i-1) deep(n) n = int(input()) deep(n)
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = int(input()); k = 1 a = [] while n > 0 : if n & 1 : a.append(k) k += 1 n = n >> 1 a.reverse() ans = "" for i in range(len(a)) : ans += str(a[i]) + " " print(ans)
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.util.Scanner; import javax.print.attribute.standard.Chromaticity; public class slim { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); char [] a=new char[((int)(Math.log10(n)/Math.log10(2)))+1]; a=Integer.toBinaryString(n).toCharArray(); for(in...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; bool SortbySecDesc(const pair<long long, long long> &a, const pair<long long, long long> &b) { return a.second > b.second; } bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) { return (a.first > b.first); } int main() { ios_base::sync...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = int(input()) ans = [] target = bin(n)[2:][::-1] for i in range(len(target)): if target[i] == '1': ans.append(i + 1) print(*ans[::-1])
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
n = bin(int(input()))[2:] l = len(n) for i in n: if i == "1": print(l, end = " ") l -= 1
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int _inf = 0xc0c0c0c0; const long long INF = 0x3f3f3f3f3f3f3f3f; const long long _INF = 0xc0c0c0c0c0c0c0c0; const long long mod = (int)1e9 + 7; const int N = 1e5 + 100; int n; stack<int> st; void p() { if (st.empty()) return; int x = st...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; long long bigmod(long long b, long long p) { if (p == 0) return 1; long long my = bigmod(b, p / 2); my *= my; my %= 1000000007; if (p & 1) my *= b, my %= 1000000007; return my; } int setb(int n, int pos) { return n = n | (1 << pos); } int resb(int n, int pos) { ...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cerr.writ...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
f=lambda:map(int,input().split()) n=int(input()) s='1 '*n for i in range(1,n//2+1): s=s.replace(str(i)+' '+str(i),str(i+1)) print(s)
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
from sys import setrecursionlimit setrecursionlimit(10**6) numSlimes = int(input()) # Get input stdin row = list() aSlime = 1 for i in range(numSlimes): row.append(aSlime) while len(row) >= 2 and (row[-2] == row[-1]): v1 = row.pop() v2 = row.pop() v = v1 + 1 row.append(v) p...
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; const long long INF = 2e18; const int INFINT = 2e9; const int N = 1000006; const int NN = 1006; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; vector<int> v; for (int i = 0; i < 32; i++) { if ((1 << i) & n) v.push_back(i + 1); } for (int i = v...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
#include <bits/stdc++.h> using namespace std; const long long linf = 1e18 + 5; const int mod = (int)1e9 + 7; const int logN = 17; const int inf = 1e9; const int N = 2e5 + 5; int main() { int n; scanf("%d", &n); for (int i = 30; i >= 0; i--) if (n >= (1 << i)) { printf("%d ", i + 1); n -= (1 << i);...
CPP
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import math n=int(input()) def func(n,op): if n==1: op.append(1) return(op) elif n==2: op.append(2) return op elif math.log(n,2)%1==0: op.append(int(math.log(n,2)+1)) return op else: op.append(int(math.log(n,2)+1)) n-=2**(int(math.log(n,2))...
PYTHON3
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.B...
JAVA
618_A. Slime Combining
Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all a...
2
7
import java.util.Arrays; import java.util.HashSet; import java.util.PriorityQueue; import java.util.Scanner; public class tmp { public static void main(String[] Args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String ret = ""; int x = 1; while (n!=0){ if (n%2==1) ret = x +" " + ret; ...
JAVA