prompt
string
response
string
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.util.*; public class Main { public static void main(String[]args){ Scanner kb = new Scanner(System.in); while(kb.hasNext()){ int n = kb.nextInt(); int m = kb.nextInt(); int a=m;//xiao int b=m;//zhong int c=m;//da int d=0; while(!(a==n&&b==n&&c==n)){ if(a>b){int t=a;a=b;b=t;...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; const int MX = -1; int main() { int a, b, c; int p, k; cin >> p >> k; a = b = c = k; int wyn = 0; while (1) { a = min(p, b + c - 1); if (a > b) swap(a, b); if (a > c) swap(a, c); if (b > c) swap(b, c); ++wyn; if (a == p && b == p && c == ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; void customrun() {} void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } bool isprime(long long n) { for (long long i = 2; (long long)i * i <= n; i++) { if (n % i == 0) { return false; } } return true; } long long fib(in...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Created by MohannadHassanPersonal on 9/14/16. */ public class MemoryAndDeEvolution { public static void main(String [] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReade...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x, y = [int(x) for x in input().split(' ')] triset = [y] * 3 c = 0 while sum(triset) < x*3: triset.sort() triset[0] = triset[2] + triset[1] - 1 if triset[0] > x: triset[0] = x c += 1 print(c)
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { int x, y, count = 0; int ar[3]; cin >> x >> y; for (int i = 0; i < 3; i++) ar[i] = y; while (ar[0] + ar[1] + ar[2] != 3 * x) { ar[0] = min(x, ar[1] + ar[2] - 1); sort(ar, ar + 3); count++; } cout << count; return 0; }
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
a,b = raw_input().split() a = int(a) b = int(b) if a == b: print 0 exit() c = 0 tri = [b,b,b] while 1: tri.sort() maxx = tri.pop() midd = tri.pop() minn = tri.pop() minn = midd + maxx - 1 if minn > a: minn = a tri = [minn, midd, maxx] c += 1 if tri == [a,a,a]: break print c
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { static int i, j, k, n, m, t, y, x, sum = 0; static long mod = 1000000007; static FastScanner fs = new FastScanner(); static PrintWriter out =...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
//package cf712; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; public class cf3 { public static void main(String[] args){ BufferedReader br = new Buffered...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.util.Scanner; import java.util.Arrays; public class Main { static int x, y; public static void main(String[] args){ Scanner sc = new Scanner(System.in); x = sc.nextInt(); y = sc.nextInt(); int sec = 0; int[] tri = new int[]{y, y, y}; while(tri[0] != x || tri[1] != x || tri[2] != ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; struct cmp { bool operator()(pair<int, int> a, pair<int, int> b) { return a.second > b.second; } }; long long modpow(long long base, long long exp, long long mod) { base %= mod; long long result = 1; while (exp > 0) { if (exp & 1) result = (result * base) ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x, y = map(int, input().split()) x, y = y, x A = x B = x curr = x count = 0 while curr < y: curr = B + A - 1 A, B = B, curr count += 1 count += 2 print(count)
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
from sys import stdin n,m=map(int,stdin.readline().strip().split()) x=[m,m,m] ans=0 while not (x[0]>=n and x[1]>=n and x[2]>=n): ans+=1 x.sort() y=x[1]+x[2]-1 x[0]=y print(ans)
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.util.*; /** * * @author arif_ * Algo: Greedy * Level: Medium */ public class CF_taskC{ /* START OF I/O ROUTINE */ // PrintWriter for faster output public static PrintWriter out; // MyInputReader class for faster input public static class MyInputReader { ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x, y = map(int, input().split()) a, b, c = y, y, y ans = 0 while a < x: a, b, c = b, c, b + c - 1 ans += 1 print(ans)
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; //sides: 22,22,22 //sides: 22,12,11 //sides: 4,12,11 //sides: 4,8,11 //sides: 4,8,5 //sides: 4,4,5 //sides: 4,4,4 //4 -> 22 //4,4,4 //5,5,5 //5,8,5 public class C ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int x, y; cin >> x >> y; int testa = y, testb = y, testc = y; int turns = 0; while (true) { if (testa >= x && testb >= x && testc >= x) { cout << turns << endl; return 0; } turns++; if (turns ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; struct node { int x; int y; }; int main() { int x[3], y[3]; int n, m; while (~scanf("%d%d", &n, &m)) { int cnt = 0; x[0] = x[1] = x[2] = m; while (1) { sort(x, x + 3); if (x[2] >= n) break; x[0] = x[2] + x[1] - 1; cnt++; } ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x, y = map(int, raw_input().split(' ')) t = [y, y, y] goal = 3 * x finish = False cnt = 0 while not finish: for i in range(3): cnt += 1 t[i] = min(sum(t) - t[i] - 1, x) if sum(t) == goal: finish = True break print cnt
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int a = sc.nextInt(), b = sc.nextInt(); ArrayList<Integer> inp = new Arr...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x, y = map(int, raw_input().split()) last = [y, y, y] ans = 0 while last != [x, x, x]: last.sort() last[0] = min(x, last[1]+last[2]-1) ans += 1 print ans
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, need; int k = 0; cin >> a >> need; if (a > need) swap(a, need); b = a; c = a; while (!(a == need && b == need && c == need)) { if (a <= b && a <= c) { a = min(need, (b + c - 1)); } else if (b <= a && b <= c) { b = ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
def increase_triangle_side(first_side, second_side, third_side, count_increas_times, ending_length): count_increas_times += 1 if first_side > second_side: first_side, second_side = second_side, first_side if first_side > third_side: first_side, third_side = third_side, first_side first_...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
s,e = map(int,raw_input().split()) a = max(s,e) b = min(s,e) count = 0 prev = b cur = b while(cur < a): cur,prev = cur+prev-1,cur count += 1 print count+2
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import sys fin = sys.stdin # fin = open('tri.in', 'r') while True: s = fin.readline().strip() if s == '': break x, y = [int(x) for x in s.split()] a, b, c = y, y, y time = 0 while a < x: time += 1 a, b, c = b, c, b + c - 1 print(time)
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.text.Format; import java.util.*; public class Test { static BufferedReader in = null; static PrintWriter out = null; static StringTokenizer st = new StringTokenizer(""); static final boolean ONLINE_JUDGE = System.getProp...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x,y=[int(x) for x in input().split()] a,b,c=y,y,y ans=0 while a<x and b<x and c<x: mini=min(a,b,c) if mini==a: a=b+c-1 elif mini==b: b=a+c-1 else: c=a+b-1 ans+=1 print(ans+2)
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
def main(): x, s = map(int, raw_input().split()) s2 = s3 = s ans = 0 while s < x: ans += 1 s, s2, s3 = s2, s3, s2 + s3 - 1 print ans if __name__ == '__main__': main()
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.util.*; import java.math.*; import java.io.*; import java.text.*; public class practice { // heloo world nudniobv udivbo // buyfhsfnoisdfnoi public static void merge(int arr[], int l, int m, int r) { // Find sizes of two subarrays to be merged int n1 = m - l + 1; int n2 ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#import sys n=map(int,raw_input().split()) n2=n[0] n1=n[1] if n1==n2: print 0 else: mn=99999999999 l=[n1,n1,n1] step=0 ind=0 while 1==1: #print l,step,ind if l[0]>=n2 and l[1]>=n2 and l[2]>=n2: break step+=1 ind=step%3 if ind==1 : #if l[ind]!=n2: l[ind]=l[2]+l[0]-1 #step+=1 '''if l[0]>...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; vector<int> t; t.push_back(b); t.push_back(b * 2 - 1); while (t.back() < a) { int n = t.size(); t.push_back(t[n - 1] + t[n - 2] - 1); } cout << (t.size() + 1) << endl; return 0; }
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Str...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.util.*; import java.math.*; /* * Created by Epsilon Alpha on 12-Sep-16 at 4:10 AM. */ public final class DeEvolution { public static void main(String[] args) throws Exception { Parser Reader = new Parser(System.in); OutputWriter Writer = new OutputWriter(System....
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
# -*- coding: utf-8 -*- import sys def some_func(): """ """ m,n = map(int,sys.stdin.readline().split()) count = 0 x,y,z = n,n,n while True: temp = z+y-1 if temp<m: x,y,z = y,z,temp count+=1 else: count+=1 break print ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; template <class T> T power(T N, T P) { return (P == 0) ? 1 : N * power(N, P - 1); } int main() { int x, y, ok; cin >> x >> y; priority_queue<int> pq; pq.push(y); pq.push(y); pq.push(y); int cnt = 0; while (1) { int a = pq.top(); pq.pop(); int b...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int x, y, cnt, a, b, c, mn; int main() { cin >> x >> y; a = y; b = y; c = y; while (a != x || b != x || c != x) { mn = min(a, min(b, c)); if (mn == a) a = min(x, b + c - 1); else if (mn == b) b = min(x, a + c - 1); else c = min(x,...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
[x,y] = map(int,raw_input().split()) time = 0 a = b = c = y while True: if a >= x and b >= x and c >= x: print time break time += 1 if time % 3 == 1: a = b + c - 1 elif time % 3 == 2: b = a + c - 1 else: c = a + b - 1
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; public class Main { static class InputReader { BufferedReader reader; StringTokenizer tokenizer; InputReader(InputStream stream) { reader = new BufferedR...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
# (a[0], a[1], a[2]) => (y, y, y) def triangle(a, y, prt=False): if min(a) >= y: return 0 elif a[1] + a[2] - 1 >= y: return triangle([a[1], a[2], y], y) + 1 else: return triangle([a[1], a[2], a[1] + a[2] - 1], y) + 1 def main(): x, y = list(map(int, input().split(' '))) pri...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.math.BigInteger; import java.util.*; import java.io.IOException; import java.io.InputStream; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { File file = new File("in.txt"); InputStream inputStream = null; // try ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import sys i=lambda:sys.stdin.readline().strip() sys.setrecursionlimit(99999999) ii=lambda:map(int,i().split(" ")) x,y=ii() sides=[y,y,y] acc=0 while sides[0]<>x or sides[1]<>x or sides[2]<>x: sides.sort() sides[0]=min(x,sides[1]+sides[2]-1) acc+=1 print acc
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int a, b, cot; bool flag; int main() { scanf("%d%d", &a, &b); int b1, b2, b3; b1 = b, b2 = b, b3 = b; while (1) { flag = 0; if (b2 != a) { if (b1 + b3 <= a) { b2 = b1 + b3 - 1; cot++; } else { b2 = a; cot++; ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
n,m = map(int,input().split()) s = [m,m,m] ans = 0 while s[0] < n: val = min(n,s[1]+s[2]-1) s[0] = s[1] s[1] = s[2] s[2] = val ans+=1 print(ans)
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; const int size1 = 4e5; const int INF = 2e9; int main() { int x, y; cin >> y >> x; int a = x, b = x, c = x; int k = 0; while (a != y) { k++; a = min(y, b + c - 1); if (a > b) { swap(a, b); } if (b > c) { swap(b, c); } } cout ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x,y=map(int,input().split()) a,b,c=y,y,y turn=0 while True: if a>=x and b>=x and c>=x: print(turn) break if turn%3==0: a=b+c-1 elif turn%3==1: b=c+a-1 else: c=a+b-1 turn+=1
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m; cin >> m >> n; long long int x1 = n, x2 = n, x3 = n, count = 0; while (1) { if (x2 + x3 > m) { count += 3; break; } x1 = x2 + x3 - 1; count++; if (x1 + x3 > m) { count += 3; break; } ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { int x, y; scanf("%d%d", &y, &x); int a[3]; a[0] = x; a[1] = x; a[2] = x; int ans = 0; while (1) { sort(a, a + 3); if (a[0] == a[1] && a[1] == a[2] && a[2] == y) { printf("%d\n", ans); return 0; } a[0] = min(y, a[1] + ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } int s[5]; int n, ans = 0; int ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); int test_cases = 1; Solver s = new Solver(); for (int i = 1; i <= test_cas...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; const int INF = int(1e9); const double EPS = 1e-8; struct debugger { template <typename T> debugger& operator,(const T& v) { cerr << v << " "; return *this; } } dbg; int main() { std::ios_base::sync_with_stdio(false); int x, y; cin >> y >> x; vector<in...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { long x, y, a[3]; cin >> x >> y; a[0] = a[1] = a[2] = y; long i = 0, cnt = 0; while (a[0] != x && a[1] != x && a[2] != x) { if (i > 2) i = 0; switch (i) { case 0: { a[0] = a[1] + a[2] - 1; if (a[0] > x) a[0] = x; } b...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
###### ### ####### ####### ## # ##### ### ##### # # # # # # # # # # # # # ### # # # # # # # # # # # # # ### ###### ######### # # # # # # ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { int p, q; while (cin >> p >> q) { int ans = 0; int a, b, c; a = b = c = q; while (c < p) { int newC = b + c - 1; a = b; b = c; c = newC; ans++; } if (a != p) ans++; if (b != p) ans++; cout << ans...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const int INF = 0x3f3f3f3f; const double inf = 0x3f3f3f3f3f3f; const double PI = acos(-1.0); const double eps = 1e-8; const int maxn = 1e5 + 5; const int mod = 1e9 + 7; const int dr[] = {-1, 0, 1, 0}; const int dc[] = ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.util.*; import java.io.*; import java.math.*; import java.math.BigInteger; public class test { static long sum=0,sum1=Long.MAX_VALUE; static int count; public static void main(String args[]) { InputReader in = new InputReader(System.in); OutputStream outputStream = System.out; PrintWriter out = n...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int a = sc.nextInt(), b = sc.nextInt(); ArrayList<Integer> inp = new Arr...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
eKnBQaHTzrUcYtwjiVCG = map eKnBQaHTzrUcYtwjiVCo = int eKnBQaHTzrUcYtwjiVCX = input eKnBQaHTzrUcYtwjiVCA = sorted eKnBQaHTzrUcYtwjiVCN = min eKnBQaHTzrUcYtwjiVCF = print x, y = eKnBQaHTzrUcYtwjiVCG( eKnBQaHTzrUcYtwjiVCo, eKnBQaHTzrUcYtwjiVCX().split()) a, b, c = y, y, y k = 0 while a != x: a, b, c = eKnBQaHTzrUc...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { int x, y; scanf("%d%d", &x, &y); int a[5], cnt = 0; a[0] = a[1] = a[2] = y; while (1) { sort(a, a + 3); if (a[0] < x) { a[0] = a[1] + a[2] - 1; } else { break; } cnt++; } printf("%d\n", cnt); }
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
from random import random import math import re import fractions a, b = map(int, raw_input().split(" ")) # BF if a == b: print 0 else: r = [b, b, b] i = 0 while r[2] < a: t = min(r[0] + r[1] - 1, a) r = [t, r[0], r[1]] # print r i += 1 print i
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.util.Scanner; public class DeEvolution { public static int[] sort(int[] edges) { int a = edges[0]; int b = edges[1]; int c = edges[2]; if (b < a && b <= c) { int temp = a; a = b; b = temp; } else if(c < a && c <= b) { int temp = a; a = c; c = temp; } edges[0] = a; ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { int x, y; cin >> x >> y; int a = min(x, y); int b = max(x, y); int arr[3]; for (int i = 0; i < 3; i++) { arr[i] = a; } long long res = 0; while (1) { sort(arr, arr + 3); int x = arr[1] + arr[2] - 1; if (arr[0] == b) break; ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1E5 + 5; const int MOD = 1E9 + 7; const int MAXVALUE = 1E9 + 10; int x, y, ret = 0; int main() { cin >> x >> y; int a[5]; a[0] = a[1] = a[2] = y; while (true) { if (a[0] == a[1] && a[1] == a[2] && a[2] == x) break; sort(a, a + 3); a[0] =...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
/** * Author:-Harsh Chaudhari * College:-DA-IICT */ import java.util.*; import java.io.*; public class C712 { public static void main(String[] args) { InputReader s = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); /*My code starts here.*/ int n = s.nextInt(), k = s.nextInt(); ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * Created by Admin on 16.09.2016. */ public class C_712 { static int get_i_min(int a[]){ int min = a[0], mini = 0; for (int i = 1; i < 3; i++) { if(a[i]...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.util.*; public class Main { public static void main(String args[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s=br.readLine(); String str[]=s.split(" "); int x=Integer.parseInt(str[0]); int y=Integer.parseInt(str[1]); ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.util.*; import java.math.*; public class Solve3 { static boolean isValid(int a, int b, int c) { return a + b > c && a + c > b && b + c > a; } public static void main(String[] args) { MyScanner scanner = new MyScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStre...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> int main() { long x, y, a, b, c, tmp, count = 0; scanf("%ld%ld", &x, &y); a = y; b = y; c = y; while (c != x) { tmp = a + b - 1; if (tmp > x) tmp = x; c = b; b = a; a = tmp; count++; } printf("%ld\n", count); return 0; }
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; @SuppressWarnings("unchecked") public class P712C { public void run() throws Exception { int aa = nextInt(), mm = nextInt(), a = Math.min(aa, mm), b = a, c = a, m = Math.max(aa, mm), k = 0; while (a != m) { a = b...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc=new Sc...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(Sy...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.awt.Point; import java.awt.geom.Line2D; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.security.GuardedObject; im...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; const int MAX = 3e6 + 7; const int mod = 998244353; const double eps = 1e-7; int ca = 1; int a[4]; int x, y; void solve() { scanf("%d%d", &x, &y); int ans = 0; a[0] = a[1] = a[2] = y; while (a[0] < x || a[1] < x || a[2] < x) { sort(a, a + 3); a[0] = a[2] + a...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int x, y, a[3], k; int main() { cin >> x >> y; swap(x, y); a[0] = a[1] = a[2] = x; while (a[0] < y || a[1] < y || a[2] < y) { if (a[0] > a[1]) swap(a[0], a[1]); if (a[1] > a[2]) swap(a[1], a[2]); if (a[0] > a[1]) swap(a[0], a[1]); a[0] = min(y, a[1] ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; const long long int no = 3e6 + 5, modulo = 1e9 + 7, inf = 1e18, N = 3e3 + 1; long long int ar[no], br[no], cr[no]; long long int ans = 0; void calc(long long int x, long long int y, long long int z, long long int aim, long long int t) { if (x == aim and y == aim...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { priority_queue<int> qu; int x, y; cin >> x >> y; int step = 0; qu.push(y); qu.push(y); qu.push(y); for (;;) { int max1 = qu.top(); qu.pop(); int mid1 = qu.top(); qu.pop(); int min1 = qu.top(); qu.pop(); if (min1 == x ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const int inf = 1e9; const int mod = 1e9 + 7; const long long INF = 1e18; int x, y, a, b, c, res; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> x >> y; if (x < y + y) { return cout << 3, 0; } if (x == y + y) { ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x, y = map(int,input().split()) a = [y,y,y] cnt = 0 while True: if a[0] == a[1] == a[2] == x: break if a[1] + a[2] > x: a[0] = x else: a[0] = a[1] + a[2] - 1 cnt+=1 a.sort() print(cnt)
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; const string NAME = "712C"; int x, y; void input() { cin >> x >> y; } void solve() { int a[] = {y, y, y}, res = 0; while (a[0] != x) { a[0] = min(x, a[1] + a[2] - 1); sort(a + 0, a + 3); res++; } cout << res; } int main() { ios_base::sync_with_stdio(fa...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x,y = map(int, raw_input().strip().split()) a = [y,y,y] count = 0 while (True): if (a[0] == a[1] == a[2] == x): break if (a[1] + a[2] > x): a[0] = x else: a[0] = a[1] + a[2] - 1 count += 1 a.sort() print count
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x, y = map(int, raw_input().split()) r = [y] * 3 i = 0 while r[0] < x: r[0] = min(r[1]+r[2] - 1, x) r.sort() i += 1 print i
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
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 * * @author wistful */ public class Main { public static void main(String[] args) { InputStream i...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { int m, n; int a[4]; while (~scanf("%d%d", &m, &n)) { int sum = 0; a[0] = n, a[1] = n, a[2] = n; while (a[0] < m) { sum++; a[0] = a[1] + a[2] - 1; sort(a, a + 3); } printf("%d\n", sum); } return 0; }
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
g,a=[int(x) for x in input().split()] b=c=a s=0 while min(min(a,b),c)<g: s+=1 l=[a,b,c] l.sort() a,b,c=l a=min(g,c+b-1) print(s)
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
n ,m=map(int,input().split()) a,b,c= m,m,m cou =0 if(n==m): print(0) exit() while(True): if(a<b): if(a<c): a = min(b+c-1,n) else: c= min(a+b-1,n) else: if(b<c): b=min(a+c-1,n) else: c= min(a+b-1,n) cou+=1 if(a==n and...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { int x, y; cin >> x >> y; int ans = 0; vector<int> v(3, y); while (v[0] < x) { v[0] = min(v[1] + v[2] - 1, x); ans++; sort(v.begin(), v.end()); } cout << ans << endl; return 0; }
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
s, d = map(int, raw_input().split()) #Reversing the solution d = [d] * 3 count = 0 while d[0] < s: d[0] = min(d[2] + d[1] - 1, s) d.sort() count += 1 print count
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x,y = map(int,input().split()) arr = [y,y,y] c = 0 t = 0 while True: if(arr.count(x)==3): break if(t==0): arr[0] = arr[1]+arr[2]-1 if(arr[0]>x): arr[0] = x t = 1 elif(t==1): arr[1] = arr[0]+arr[2]-1 if(arr[1]>x): arr[1] = x t =...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int x, y, a[4], sum; int main() { scanf("%d%d", &x, &y); for (int i = 1; i < 4; i++) a[i] = y; while (1) { sort(a + 1, a + 4); if (a[1] != x) { sum++; if (a[2] + a[3] > x) a[1] = x; else a[1] = a[2] + a[3] - 1; } if (a...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
A, B = map(int, raw_input().split()) count = 0 cur = [B] * 3 while cur[0] < A: cur[0] = min(A, cur[1] + cur[2] - 1) cur.sort() count += 1 print count
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 10; int n, m, a[5]; int main() { int x, y; scanf("%d%d", &x, &y); for (int i = 1; i <= 3; i++) { a[i] = y; } int cnt = 0; while (1) { sort(a + 1, a + 1 + 3); a[1] = a[2] + a[3] - 1; cnt++; if (a[1] > x && a[2] > x && a[...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) throws FileNotFoundException { InputReader in=new InputReader(System.in); PrintWriter out=new PrintWriter(System.out); //Scanner in=new Scanner(System.in); int n=in.nextInt(); int m=in.nex...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x, y = map(int, input().split()) counter = 0 x, y = min(x,y), max(x,y) x1 = x x2 = x x3 = x while y > x1 or y > x2 or y > x3: if x1 != y: x1 = min(x3 + x2 - 1, y) counter += 1 if x2 != y: x2 = min(x1 + x3 - 1, y) counter += 1 if x3 != y: x3 = min(x1 + x2 - 1, y) ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int main() { int ar[5], n, i, j, k, x, y, s = 0; scanf("%d%d", &x, &y); ar[0] = y; ar[1] = y; ar[2] = y; while (1) { if (ar[0] == x && ar[1] == x && ar[2] == x) break; s++; sort(ar, ar + 3); n = ar[1] + ar[2] - 1; if (n <= x) ar[0] = n;...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.util.*; import java.io.*; public class he{ static int min(int a,int b){ return (a<b)?a:b; } public static void main(String[] args){ Scanner s = new Scanner(System.in); int x,y,z;int a; a = s.nextInt(); x = s.nextInt(); y = z = x; int c = 0; while(x<a || y<a || z<a){ if(x<y && x<z){ ...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
x, y = map(int, input().split()) temp = [y]*3 k = y cnt = 0 while k != x: temp.sort() temp[0] = min(temp[1]+temp[2]-1, x) k = min(temp) cnt += 1 print(cnt)
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.*; /** * Built using CHelper plug...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> using namespace std; int n; int main() { int x, y; scanf("%d %d", &x, &y); int x1 = y; int x2 = y; int x3 = y; int ans = 0; while (x1 < x) { x1 = (x2 + x3) - 1; swap(x1, x2); swap(x2, x3); ans++; } printf("%d", ans); return 0; }
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class problemC { static int x, y; public static void main(String[] args) throws Exception { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); PrintWri...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:36777216") using namespace std; const int N = 100001; int main() { int a, b, c, x, y; cin >> x >> y; a = b = c = y; int ans = 0; while (1) { ans++; c = a + b - 1; y = c; c = b; b = a; a = y; if (c >= x) break; } cout << a...
Problem: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangl...
// package CodeForces; import java.io.*; import java.util.*; public class Problem_712C { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); PrintWriter pw = new PrintWriter(System.out); int x=sc.nextInt(),y=sc.nextInt(); int[]a=new int[3]; int min=Integer.MAX_VALUE; // ...