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 java.util.*; public class Slime { public static void main (String[]args) { Scanner sc=new Scanner (System.in); int n=sc.nextInt(); String out=""; int x; while(n>0){ x=(int)((double)Math.log(n)/Math.log(2)); out+=(x+1)+" "; n=n-(int)Math.pow(2, x); } Sys...
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.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); int count = 1; int list[] = new int[n]; list[0] = 1; for(int i = 1; i < n; i++) { list[count] = 1; count++; ...
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 main(): n = int(input()) print(*solver(n)) def solver(n): s = bin(n)[2:] result = [] for i in range(len(s)): if s[i] == '1': result.append(len(s) - i) return result main() #print(*solver(11))
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; scanf("%d", &n); vector<int> ans; while (n > 0) { int rt = 1; int cnt = 0; while (rt <= n) { rt <<= 1; cnt++; } rt /= 2; n -= rt; ans.push_back(cnt); } for (int i = 0; i < ans.size(); i++) { if (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 java.util.*; import java.io.*; import java.awt.geom.*; import java.math.*; public class A { static final Scanner in = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static void solve() { int n = in.nextInt(); int x = 1; ArrayList<Integer> ans = new ArrayList...
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 fun(n): if n==0: return [""] x=int(math.log(n,2)) return [str(x+1)]+fun(n-2**x) def solve(): n=input() s= fun(n) print " ".join(s) solve()
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
def solution(n): # 1 1 1 1 1 1 1 1 # 2 1 1 1 1 1 1 # 2 2 1 1 1 1 # 3 1 1 1 1 # 3 2 1 1 # 3 2 2 # 3 3 # 4 # 1 1 1 1 # 2 1 1 # 2 2 # 3 # 1 1 1 # 2 1 if n==1: return 1 l1 =...
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()) s = bin(n)[2:] num = len(s) for f in s: if f == '1': print(num, end = ' ') num -= 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.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.Sta...
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 double PI = acos(-1.0); const int MOD = 1e9 + 7; const int INF = 1e9 + 9; const int MX = 1e5 + 5; int n, inp[MX]; int main() { cin >> n; if (n <= 2) { cout << n << endl; return 0; } int pt = 1; inp[1] = 2; for (int i = 3; i <= n; i++) { int cu ...
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 a[100000]; int main() { int n, i, x = -1; cin >> n; for (i = 0; i < n; i++) { x++; a[x] = 1; while (i > 0 && a[x] == a[x - 1]) { a[x - 1]++; x--; } } for (i = 0; i <= x; i++) cout << a[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; bool myfunction(int a[], int n); int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) a[i] = 1; while (1) { if (!myfunction(a, n)) break; } for (int i = 0; i < n; i++) { if (a[i] != 0) cout << a[i] << ' '; } return 0; } bool myfuncti...
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.*; public class CF618A { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int j = n; int[] binary = new int[n]; int counter = 0; while(n > Math.pow(2, counter)) counter++; 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
//package com.codeforces.competitions.year2016.jantomarch.wunderfundround; import java.io.*; import java.util.*; public final class TaskA { static int n, m, a; static InputReader in; static OutputWriter out; public static void main(String[] args) { in = new InputReader(System.in); out = new OutputWriter(Sys...
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 secTL(deque<int> q) { int temp = q.back(); q.pop_back(); int ret = q.back(); q.push_back(temp); return ret; } int main() { int n; cin >> n; deque<int> q; for (int i = 0; i < n; i++) { q.push_back(1); while (q.size() > 1 && q.back() == secTL(q))...
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(raw_input()) a = [1]*n c = 1 for i in range(1,n): j = c while a[j] == a[j-1] and j-1>=0: a[j-1] = a[j] + 1 a[j] = 1 j-=1 c = j + 1 for i in range(c): print a[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; void solve() { int n; cin >> n; string s = bitset<32>(n).to_string(); vector<int> v; for (int i = 31; i >= 0; i--) { if (s[i] == '1') { v.push_back(32 - i); } } reverse(v.begin(), v.end()); for (int& a : v) { cout << a << " "; } } int mai...
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 check(arr): while True: last = len(arr) - 1 before_last = len(arr) - 2 if last >= 0 and before_last >= 0: if arr[last] == arr[before_last]: arr[before_last] = arr[before_last] + 1 del arr[last] else: break e...
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.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; public class P618A { InputStream is; PrintWriter out; String INPUT = "3"; ...
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
/** * Created by shambala on 30/01/16. */ import java.util.*; import java.io.*; public class TaskA { FastScanner in; PrintWriter out; public void solve() throws IOException { int n = in.nextInt(); int[] pow = new int[100]; pow[0] = 1; for (int i = 1; i<100; 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
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vi; for (int i = 0; i < n; i++) { vi.push_back(1); while (vi.size() >= 2 && vi[vi.size() - 1] == vi[vi.size() - 2]) { int xx = vi.back(); vi.pop_back(); vi.pop_back(); vi.push_back(xx + 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.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int[] s = new int[n]; int sp = 0; for (int i = 0; i < n; i++) { s[sp++] = 1; while (sp...
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
l = [] def fun(n, i): if(n==1): l.append(i) return if n%2==1: l.append(i) fun(n/2,i+1) n = int(raw_input()) fun(n,1) l = l[::-1] for x in l: print x,
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.*; import java.util.StringTokenizer; public class ProblemA { public static void main(String[] args) { int testMode = 0; String testInput = "2\n"; /*-------------------------------------------------------------------------------------------------------*/ FastReader 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
import java.util.*; import java.io.*; public class CF618A{ public static void main(String[] args){ InputReader sc = new InputReader(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); Stack<Integer> s1 = new Stack<Integer>(); while(n>0){ s1.push(n%2); n=n/2; } int an...
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.Scanner; /** * Created by yuu on 11/4/17. */ public class Problem618A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String n = Integer.toBinaryString(sc.nextInt()); for (int i = 0; i < n.length(); i++) { if (n.charAt(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
import java.util.Scanner; public class JavaApplication14 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n=input.nextInt(); int ara[]=new int[100]; int j=0; int l=0; while(n>0){ l++; if(n%2!=0)...
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(raw_input()) s = "{0:b}".format(n) d = len(s) out = "" for c in s: if c == '1': out += str(d) + " " d -= 1 print out.rstrip()
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
if __name__ == '__main__': num = str(bin(int(input()))).replace('0b', '') size = len(num) line = list() for i in range(size): if num[i] == '1': line.append(str(size - i)) print(' '.join(line))
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.InputStreamReader; import java.io.PrintWriter; public class SlimeCombining { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.ou...
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() { ifstream fi("input.txt"); int n, ans = 0, r = 1; cin >> n; vector<int> a(n); a[0] = 1; for (int i = 1; i < n; i++) { a[r] = 1; if (a[r] == a[r - 1]) { a[r - 1] += 1; a[r] = 0; } else r++; if (r > 1) { while (a...
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 solve(): n = bin(int(input()))[-1:1:-1] print(' '.join(map(str, [i + 1 for i in range(len(n)) if n[i] == '1'][::-1]))) if __name__ == "__main__": solve()
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.ArrayList; import java.util.Scanner; public class codeforces_slimes { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int N=sc.nextInt(); long[] dp=new long[N]; int prev=0 ,pre=1; dp[0]=1; int k=1; for(int i=1 ; i< N ;i++ ,k++ ){ dp[k]=1; whil...
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 A { public static int powerOftwo(int n){ int i = 0; for (i = 0; (1<<i) <= n; i++); return i-1; } public static void main(String[] args) throws Exception { // TODO Auto-generated method stub BufferedR...
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.Scanner; public class MainClass { public static void main(String []argh) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int arr[] = new int[n]; int current=0; for(int i=0; i<n; i++) { arr[current]++; f...
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.Scanner; public class Test { 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]=0; } arr[0]=1; int k=0; for(int i=1;i<n;i++){ k++; arr[k]=1; while(k>0&&arr[k]==arr[k-1]){ arr[...
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() { cin.sync_with_stdio(0); int n; cin >> n; for (int i = 30; i >= 0; --i) { if ((1 << i) & n) { 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 sys n = int(sys.stdin.read()) slimes = [1] for i in range(n-1): slimes.append(1) pos = len(slimes) - 1 while pos > 0 and slimes[pos] == slimes[pos-1]: del slimes[pos] slimes[pos-1] += 1 pos -= 1 print(' '.join(str(slime) for slime in slimes))
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()) p = [] for i in range(n): p.append(1) try: while p[-1] == p[-2]: p[-2] += 1 del p[-1] except: pass for k in p[:-1]: print(k, sep=' ', end=' ') print(p[-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
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { // your code goes here BufferedReader ...
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; int tim(int n) { int res = 0; for (int i = 0; 1 << i <= n; ++i) res = i; return res; } int main() { cin >> n; while (n > 0) { int x = tim(n); cout << x + 1 << " "; n -= 1 << x; } 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 sys import math n=int(raw_input("")) x=math.log(n,2) s=[] s.append("") s.append("1") s.append("2") s.append("2 1") a=2 for i in range(4,n+1): if i>=2**(a+1): a+=1 s.append(str(a+1)+" "+s[i-2**a]) print s[n]
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 = int(input()) power = [1] * 100 for i in range(1, 100): power[i] = power[i - 1] * 2 answer = [] a = 99 while n > 0: if n >= power[a]: n -= power[a] answer.append(a + 1) a -= 1 print(*answer)
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 = [] for x in range(int(input())): a.append(1) while len(a) > 1 and a[-1] == a[-2]: a.pop() a.append(a.pop() + 1) print(*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; /** * * @author ramilagger * */ public class Main { public final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public fina...
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 io #~ import sys #~ test = '1' #~ test = '2' #~ test = '3' #~ test = '8' #~ sys.stdin = io.StringIO(test) n = int(input()) a = [] def simplify(a): if len(a)<=1: return if a[-2]==a[-1]: del a[-1] a[-1] += 1 simplify(a) for i in range(n): a.append(1) simplify(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
n=int(input()) l=[1] for i in range(2,n+1): l+=[1] while len(l)>=2: if l[-1]==l[-2]: l=l[:-2]+[l[-1]+1] else: break print(' '.join(map(str,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
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 1) { cout << n << endl; return 0; } vector<int> v(n, 1); for (int j = 0; j < pow(v.size(), 4); j++) for (int i = 1; i < v.size(); i++) { if (v[i] == v[i - 1]) { v[i - 1] += 1; v.erase(v.beg...
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(raw_input()) ans = [] while n != 0: i = 0 j = 2 ** (i+1) while j <= n: i = i + 1 j = 2 ** (i + 1) ans.append(i+1) n = n - (2 ** i) print ' '.join(map(str,ans))
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 argc, char const *argv[]) { std::vector<int> v; int t; cin >> t; for (int i = 0; i < t; i++) { v.push_back(1); while (v[v.size() - 1] == v[v.size() - 2]) { v[v.size() - 2]++; v.pop_back(); } } for (int i = 0; i < v.size(); 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 java.io.*; import java.util.*; public class Cf618A { public static void main(String args[]) throws IOException { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); char a[] = Integer.toBinaryString(n).toCharArr...
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=input() b=30 while b >= 0: if 1<<b & n:print b+1 b -= 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
n = int(raw_input().strip()) bin = [] while n > 0 : bin.append(n % 2) n /= 2 for i in xrange(len(bin), 0, -1): if bin[i - 1]: print bin[i - 1] * 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> #pragma GCC optimize("O3") #pragma GCC target("sse4") using namespace std; template <class T> T gcd(T a, T b) { return ((b == 0) ? a : gcd(b, a % b)); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> s = {1}; for (int i = (int)(1); i < (int...
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
# -*- coding:utf-8 -*- import sys def some_func(): """ """ n = input() lit =[] count =1 while n: if n%2: lit.append(count) n= n/2 count+=1 for v in lit[::-1]: print v, if __name__ == '__main__': some_func()
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 = int(input()) s = bin(n) s = s[2:] k = len(s) for i, x in enumerate(s): if x == '1': print(k - 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.io.*; import java.util.*; import java.math.BigInteger; import java.util.Map.Entry; import static java.lang.Math.*; public class A extends PrintWriter { void run() { int n = nextInt(); for (int i = 27; i >= 0; i--) { if ((n & (1 << i)) > 0) { print(i + 1); print(' '); } } } boole...
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
list=[0] n=int(input()) for i in range(1,n+1): list.append(1) while list[len(list)-1]==list[len(list)-2]: del list[len(list)-2] list[len(list)-1]+=1 for i in range(1,len(list)): print(list[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 com.sun.org.apache.bcel.internal.generic.AALOAD; import com.sun.org.apache.bcel.internal.generic.GOTO; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; import java.util.stream.IntStream; impo...
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; import java.io.PrintWriter; import java.lang.String; import java.util.Scanner; public class A { public static void main(String[] args) { // TODO Auto-generated method stub Scanner reader = new Scanner(System.in); Print...
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 double pi = acos(-1.0); const double eps = 1e-11; const int INFINITE = 0x3f3f3f3f; template <class T> inline void checkmin(T &a, T b) { if (b < a) a = b; } template <class T> inline void checkmax(T &a, T b) { if (b > a) a = b; } template <class T> inline T sqr(T 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; int main() { int n, i; cin >> n; vector<int> v; while (n != 0) { v.push_back(n % 2); n /= 2; } for (i = v.size() - 1; i >= 0; i--) { if (v[i] == 1) 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
#include <bits/stdc++.h> using namespace std; int a[10010]; int main() { int n; memset(a, 0, sizeof(a)); cin >> n; int cnt = 0; while (n--) { a[++cnt] = 1; while (a[cnt] == a[cnt - 1]) { a[cnt - 1]++; cnt--; } } for (int i = 0; i < cnt; i++) cout << a[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()) l=[] for i in range(n): l.append(1) while len(l)>=2 and l[-1]==l[-2]: l.pop() l[-1]+=1 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()) def rec(l): while l[-1] == l[-2]: l[-2] += 1 l.pop() return l res = [0] for i in range(n): res.append(1) res = rec(res) print(" ".join(map(str, res[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(raw_input()) bitn=bin(n) reversebitn=bitn[::-1] kintegers=[] for i in xrange(0,len(reversebitn)): if reversebitn[i]=="1": kintegers.append(i+1) for x in kintegers[::-1]: print x,
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.util.Scanner; public class Russia_A { static int n; public static void readData() { Scanner sc = new Scanner(System.in); n = sc.nextInt(); } public static void main (String args[]) { readData(); int i,nr=0; int c[]=new int[100]; while(n>0) { c[nr]=n%2; n/=2; nr++; } for...
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.math.*; import java.util.*; import java.util.stream.*; @SuppressWarnings("unchecked") public class P618A { public void run() throws Exception { for (int n = nextInt(), b = 1 << 16, i = 17; n > 0; b >>>= 1, i--) { if ((n & b) != 0) { print(i + " "); n ^= 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.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int x = Int...
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
k=int(input()) a=[0] i=0 while(i<k): a.append(1) while a[len(a)-1]==a[len(a)-2]: a.remove(a[len(a)-1]) a[len(a)-1]+=1 i+=1; for i in range(1,len(a)): print(a[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
n = int(input()) p = [] def zzip(p): while True: if len(p) < 2: return p sl = p.pop() slr = p.pop() if sl == slr: p.append(sl + 1) else: p.append(slr) p.append(sl) return p for i in range(0, n): p.append(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()) slimes=[] slimes.append(1) for i in range(n-1): slimes.append(1) while 1: #print("h") if len(slimes)==1 or (slimes[-1] !=slimes[-2]) : break slimes[-2]+=1 del slimes[-1] print (*slimes)
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 slimes, values; vector<int> vec; cin >> slimes; for (int i = 0; i < slimes; i++) { vec.push_back(1); while (vec.size() > 1 && vec[vec.size() - 1] == vec[vec.size() - 2]) { vec.pop_back(); vec[vec.size() - 1] += 1; } } for...
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
r=lambda:map(int,raw_input().split()) n=input() if n == 1: print 1 exit(0) s=[1] n-=1 while n: s.append(1) while len(s) >=2 and s[-1] == s[-2]: s.pop() s[-1]+=1 n-=1 print ' '.join(map(str, s))
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(void) { ios_base::sync_with_stdio(false); cin.tie(0); int64_t n; cin >> n; vector<int64_t> bits; int64_t b = 1; while (n > 0) { if (n % 2) { bits.push_back(b); } n /= 2; b++; } for (int64_t i = (int64_t)bits.size() - 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
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
from math import * x = int(input()) while x>0: print(floor(log2(x))+1,end=' ') x-=pow(2,floor(log2(x))) print()
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 a[100010]; int main(void) { int n; cin >> n; int l = -1; for (int i = 0; i < n; i++) { l++; a[l] = 1; while (l >= 1 && a[l] == a[l - 1]) { a[l - 1] += 1; l--; } } for (int i = 0; i <= l; i++) { cout << a[i] << ' '; } retur...
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 stiva[100005]; int sz; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { stiva[++sz] = 1; while (sz > 1 && stiva[sz] == stiva[sz - 1]) stiva[sz - 1]++, sz--; } for (int i = 1; i <= sz; ++i) cout << stiva[i] << " \n"[i == sz]; 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()) li= [] li.append(1) j = 1 for i in range(n-1): li.append(j) while len(li)>1: if li[-1]==li[-2]: li[len(li)-2]+=1 li.pop(len(li)-1) else: break print(*li)
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()) out=[] cur=1 while n>0: if n%2==1: out.append(cur) cur+=1 n//=2 out.reverse() print(*out)
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=int(input());p=2;a=[];b=[] for i in range(x): if p**i>x:break a.append(p**i) a=a[::-1] for i in range(len(a)): if a[i]<=x: b.append(len(a)-i) x=x-a[i] if x==0:exit(print(*b))
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()) s=bin(n)[2:] x=len(s) for i in s : if i=="1": print x, x-=1 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
N = int(input()) ans = [] cnt = 1 while N != 0: if N % 2 != 0: ans.append(cnt) N = N // 2 cnt += 1 ans.reverse() print(" ".join(map(str, 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.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here int[] pow2 = new int[20]; pow2[0]=1; for(int i=1 ;i<20 ; i++){ pow2[i] = pow2[i-1]*2; } Scanner s = new Scanner(System.in); int ...
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.Scanner; public class I { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int r[] = new int[n]; int q = 0; while (n != 0){ int t = 1; int y = 0; while (t <= n){ t = t * 2; y++; } t = t / 2; r[q] = y; q++; 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
__author__ = '11x256' n = int(raw_input()) res = [] for i in range(0,n): res.append(1) while len(res) > 1 and res[-1] == res[-2]: res= res[:-1] res[-1] +=1 s = '' for j in res: s+=str(j) s+=' ' print s[:-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
n=input() v=[] for x in range(1,n+1): v+=[1] while len(v)>1 and v[-2]==v[-1]: v.pop() v[-1]+=1 for x in v: print x,
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 arr[100001]; int main() { int n, k = 1; scanf("%d", &n); arr[0] = 1, n--; while (n--) { arr[k++] = 1; while (arr[k - 1] == arr[k - 2]) arr[k - 2]++, k--; } for (int i = 0; i < k; ++i) printf("%d ", arr[i]); 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.Scanner; public class Code { public static class Findi{ int pq; public Findi(int f) { pq=f; } public void printf() { int i=25,p; //System.out.print("rohit"); while(i>=0) { p=(1<<i); // System.out.println(p); if((pq & p)>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
n = int(input()) ans = [] st = 1 for i in range(n): ans.append(1) while len(ans) > 1 and ans[-1] == ans[-2]: ans[-2] += 1 ans.pop() 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.*; public class SlimeCombining { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int noSlimes = sc.nextInt(); String answer = ""; while(noSlimes > 2) { int i = 1; while((int)Math.pow(2, i) < noSlimes) { 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()) ans = [] num = list(bin(n)[2::]) size = len(num) for idx in range(size): if num[idx] == '1': ans.append(size - idx) print(' '.join(map(str,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.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.lang.StringBuilder; import java.util.*; public class CFWunderA { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); Buffer...
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; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; /** * Created by MrPozitivka on 01.07.2017. */ public class Task619a { BufferedReader in; PrintWriter ...
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; import java.io.PrintWriter; import java.util.StringTokenizer; public class ProblemA { public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); new Pro...
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.Scanner; import java.util.Vector; public class SlimeCombiningA618 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); Vector<Integer> vs = new Vector<Integer>(); for (int i = 0; i < n; i++) { vs.addElement(1); for (int j = vs.size() - 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
n = int(input()) A = [] while n > 0: if n % 2 == 0: A.append(0) n //= 2 else: A.append(1) n -= 1 n //= 2 A = A[::-1] for i in range(len(A)): if A[i] == 1: print(len(A) - 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
N = int(raw_input()) ans = [] i = 1 while N > 0: if N % 2 == 1: ans.insert(0, str(i)) N /= 2 i += 1 print " ".join(ans)
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> #pragma comment(linker, "/STACK:64000000") using namespace std; int n; vector<int> ans; int main() { cin >> n; for (int i = 17; i >= 0; i--) { int temp = 1 << (i); if (temp <= n) { ans.push_back(i + 1); n -= temp; } } for (int i = 0; i < ans.size(); i++) { if...
CPP