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.io.*;
import java.util.*;
import java.math.*;
public class c370C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
int y = in.nextInt();
int[] sides = new int[]{y,y,y};
int minIndex = 0;
int count = 0;
while(sides[minIndex] < 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;
int main() {
long long int a, b, c, incr;
long long int x, y;
cin >> x >> y;
int result = 0;
a = b = c = y;
while (true) {
if (a == x && b == x && c == x) break;
result++;
incr = a + b + c - min(a, min(b, c)) - 1;
if (a <= b && a <= c)
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... | // -*- coding: utf-8 -*-
//import java.awt.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream;
if (args.length > 0 && args[0].equals("devTesting")) {
try {
inputStream = new FileIn... |
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 tp {
public static void main(String args[]){
Scanner s= new Scanner(System.in);
int x=s.nextInt();
int y= s.nextInt();
int a=y,b=y,c=y;
int sec=1;
while(true){
if(a>=x && b>=x && c>=x)
{
System.out.println(sec-1);
return;
}
if(sec%3==1)
a=b+c-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... | x, a = map(int, input().split())
b = c = a
res = 0
while a < x:
a, b, c = b, c, b + c - 1
res += 1
print(res)
|
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())
cnt = 0
a=b=c=y
while not (a>=x and b>=x and c>=x):
if cnt%3==0:
a = b+c-1
elif cnt%3==1:
b = a+c-1
else:
c = a+b-1
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... | #include <bits/stdc++.h>
using namespace std;
inline int read(int x = 0, int f = 1, char ch = '0') {
while (!isdigit(ch = getchar()))
if (ch == '-') f = -1;
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
return f * x;
}
const int N = 100000 + 5;
int x, y;
int a, b, c;
int main() {
cin >> y >> 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(" "))
#print x,y
tup = [y,y,y]
goal = [x,x,x]
count = 0
while tuple(tup) != tuple(goal):
tup = sorted(tup)
tup[0] = min(tup[1] + tup[2] - 1, x)
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;
int main() {
int x, y;
cin >> x >> y;
int a = y, b = y, c = y;
int op = 1;
a = b + c - 1;
int flag = 0;
if (a >= x) {
a = x;
flag = 1;
}
while (flag == 0) {
if (op % 3 == 1) {
b = a + c - 1;
if (b >= x) {
b = x;
flag... |
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 Luck{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int x=sc.nextInt();
int y=sc.nextInt();
int[] A=new int[3];
A[0]=y;
A[1]=y;
A[2]=y;
int res=0;
while(true){
A[0]=(A[1]+A[2]-1);
Arrays.sort(A);
res+=1;
if(A[0]>=x){
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... | import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*;
public class A {
static class Node implements Comparable<Node>{
int x;
long w;
int id;
public Node(int x,long w,int id){
this.x=x;
this.w=w;
this.id=id;
}
... |
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
turn=0
while(1):
if(a>=x and b>=x and c>=x):
print(turn)
break
elif(turn%3==0):
c=a+b-1
elif(turn%3==1):
b=a+c-1
else:
a=b+c-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;
long long n, cnt, x, y, arr[3];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> x >> y;
for (long long i = 0; i <= 2; i++) arr[i] = y;
while (arr[0] != x) {
arr[0] = min(arr[1] + arr[2] - 1, x);
sort(arr, arr + 3);
cnt++;
}
cout << cn... |
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 java.lang.Exception
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
PrintWriter out=new PrintWriter(System.out);
int x,y,ans,all,i;
StringTokenizer st=new StringTokenizer(in.readLine().tr... |
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;
int a[5], ans;
int main() {
scanf("%d%d", &x, &y);
int z = x + y;
x = min(x, y);
y = z - x;
a[1] = a[2] = a[3] = x;
for (; a[1] != y || a[2] != y || a[3] != y; ++ans) {
sort(a + 1, a + 3 + 1);
a[1] = min(a[2] + a[3] - 1, y);
}
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... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
public class CF712C {
public static void main(String args[]){
InputReader 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 x, y;
int a[3];
int main() {
cin >> x >> y;
int t = 0;
for (int i = 0; i <= 2; i++) a[i] = y;
while (a[0] != x) {
t++;
sort(a, a + 3);
a[0] = a[1] + a[2] - 1;
a[0] = min(x, a[0]);
}
cout << t + 2;
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... | #include <bits/stdc++.h>
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
int x, y;
while (~scanf("%d%d", &y, &x)) {
int a[5];
a[0] = a[1] = a[2] = x;
int res = 0;
while (true) {
if (a[0] == a[1] && a[0] == a[2] && a[0] == y) break;
sort(a, a + 3);
a[0] = min(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... | def solve(x, y):
A = [y]*3
k = 0
while A[0] != x:
k += 1
A[0] = min(A[1] + A[2] - 1, x)
A.sort()
return k
x, y = map(int, input().split())
print(solve(x, 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 x, y;
int ans = 1000000000;
int solve(int a, int b, int c) {
if (c > a) swap(a, c);
if (b > a) swap(a, b);
if (c > b) swap(c, b);
if (a == b && b == c && c == x) return 0;
return solve(a, b, min(x, a + b - 1)) + 1;
}
int main() {
ios_base::sync_with_stdio(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.util.*;
import java.io.*;
public class CF712C{
public static int index;
public static void main(String[] args)throws Exception {
InputReader in = new InputReader(System.in);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
int n = in.nextInt() , m =in.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.util.*;
public class Main {
public static void main(String []args){
Scanner sc=new Scanner (System.in);
int x=sc.nextInt();int y=sc.nextInt();
int a=y,b=y,c=y;
long count=0;
while(a!=x||b!=x||c!=x){
c=a+b-1<x?a+b-1:x;
int temp=c;
c=b;b=a;a=temp;
count++;
}
System.out.println(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... | import java.util.*;
public class DeEvolution {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
int y1 = y;
int y2 = y;
int y3 = y;
int count = 0;
//int temp = y3;
while(y1!=x || y2!=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;
int ans, x;
void func(int a[]) {
int t = 0;
for (int i = 0; i < 3; i++) {
t += (a[i] == x);
}
if (t > 0) {
ans += 3 - t;
return;
}
a[0] = min(x, a[1] + a[2] - 1);
sort(a, a + 3);
ans++;
func(a);
}
int main() {
int y;
ans = 0;
cin >> 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... |
import java.util.*;
import java.io.*;
/**
*
* @author umang
*/
public class C712 {
public static int mod = 1000000007;
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int x = 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 toNumber(string s) {
int Number;
if (!(istringstream(s) >> Number)) Number = 0;
return Number;
}
string toString(int number) {
ostringstream ostr;
ostr << number;
return ostr.str();
}
int main() {
int x, y;
cin >> x >> y;
int a[3];
for (int i = 0; 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 x, y1, i = 0;
cin >> x >> y1;
int y[3];
y[0] = y[1] = y[2] = y1;
while (y[0] != x || y[1] != x || y[2] != x) {
y[i % 3] = min(y[(i + 1) % 3] + y[(i + 2) % 3] - 1, x);
i++;
}
cout << i << 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... | from math import *
def solve(a,b):
if(a[0]==b):
return 0
else:
return solve([a[1],a[2],min(b,a[1]+a[2]-1)],b)+1
a,b=(int(z) for z in input().split())
if a>b:
a,b=b,a
print(solve([a,a,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... |
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;
/**
*/
public class Main712C {
public static void main(String[] args) {
run(System.in, System.out);
}
public static void run(InputStream in, PrintStream out) {
try (Scanner sc = new Scanner(in)) {
int x = sc.nextInt();
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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.math.BigInteger;... |
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;
/**
* Link:
* http://codeforces.com/problemset/problem/712/C
*/
/**
* C. Мемори и деволюция
* Мемори изучает деволюцию различных объектов, в данный момент треугольников. Она начинает с равностороннего
* треугольника со сторонами, равными 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... | #------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "... |
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.*;
/**
* Created by birukoudzmitry on 08.06.16.
*/
public class C {
// 6,6,6 -> 3,6,6 ->
public static void main(String[] args){
MyScanner in = new MyScanner();... |
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.util.StringTokenizer;
public class R370D2P3 {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
... |
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.lang.*;
import java.io.*;
import java.util.*;
public class Evolution {
public static void main(String[] args) throws java.lang.Exception {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWrite... |
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, i, a, b, c, p = 0;
cin >> x >> y;
a = y;
b = y;
c = y;
while (a != x || b != x || c != x) {
if (a != x) {
a = b + c - 1;
++p;
}
if (a > x) a = x;
if (b != x) {
b = a + c - 1;
++p;
}
if (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;
long long x, y;
long long a[5];
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
cin >> x >> y;
a[1] = y, a[2] = y, a[3] = y;
for (long long i = 1;; i++) {
a[1] = min(x, a[2] + a[3] - 1);
sort(a + 1, a + 4);
if (a[1] == 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;
int main() {
long long int n, m, a, b, c, cn = 0;
cin >> m >> n;
a = n;
b = n;
c = n;
while (a < m || b < m || c < m) {
if (c < m) {
c = a + b - 1;
cn++;
}
if (a < m) {
cn++;
a = b + c - 1;
}
if (b < m) {
cn++;
... |
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
a,b = map(int,sys.stdin.readline().split())
la = [min(a,2*b-1),b,b]
cnt = 1
while 1<2:
la[la.index(min(la))]=min(sum(la)-min(la)-1,a)
cnt+=1
if(la==[2*b-1,a,a]):
cnt+=1
break
elif(la==[a,a,a]):
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... | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 11 21:29:34 2016
@author: sigmoidguo
"""
import sys, math
x, y = map(int, raw_input().split())
a = b = c = y
step = 0
#for i in range(7):
while True:
## stop condition
if a == x and b == x and c == x:
print step
sys.exit(0)
a1 = min(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... | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int i, x, y;
cin >> x >> y;
int a[3];
for (i = 0; i <= (int)(3) - 1; i++) a[i] = y;
int ans = 0;
for (; a[0] < x; ans++) {
a[0] = min(x, a[1] + a[2] - 1);
sort(a, a + 3);
}
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... | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> edge(3);
int target(0), curr(0);
while (cin >> target >> curr) {
fill(edge.begin(), edge.end(), curr);
int res(0);
while (true) {
bool flag = true;
for (int i = 0; i < 3; ++i) {
if (edge[i] != target) {
... |
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 round370;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class C {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int x = ni(), y = 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.Scanner;
public class memoryanddeevolution {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
String data = s.nextLine();
int from = Integer.parseInt(data.split(" ")[0]);
int to = Integer.parseInt(data... |
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())
if y*2 > x :
print 3
elif y*2 == x :
print 4
else :
ls = [y, y, y]
count = 0
while True :
if min(ls) == x :
break
count += 1
ls[count%3] = min(x, ls[(count+1)%3] + ls[(count+2)%3] - 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;
int main() {
long long res, f, x, y, l1, l2, l3, ma;
scanf("%lld %lld", &x, &y);
l1 = l2 = l3 = y;
res = 0;
f = 1;
while (l1 < x || l2 < x || l3 < x) {
res++;
if (f == 1) {
l1 = l3 + l2 - 1;
f++;
} else if (f == 2) {
l2 = l3 + l1 - ... |
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 MemoryAndDeEvolution {
static long countTime = 0;
public static void evlove(long a1,long b1,long c1, long s2, long s1){
if(s2 == s1)
return;
if(s1>=s2*2){
a1 = s2*2-1;
}
else
a1 = s1;
countTime++;
if(!(a1+b1==c1 || b1+c1==a1 || a1+c1=... |
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 final class round_370_c
{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static FastScanner sc=new FastScanner(br);
static PrintWriter out=new PrintWriter(System.out);
public static void main(String args[]) throws Exception
{
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 edge[4], sum;
int st, aim;
int main() {
cin >> aim >> st;
int count = 0;
edge[3] = edge[1] = edge[2] = st;
sum = st * 3;
while (sum != aim * 3) {
for (int i = 1; i <= 3; i++) {
if (edge[i] == aim) continue;
sum -= edge[i];
edge[i] = min(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;
vector<int> kek;
kek.push_back(y);
kek.push_back(y);
kek.push_back(y);
int count = 0;
if (x == y)
cout << 0 << endl;
else if (x > y) {
kek[1] = min(x, kek[0] + kek[2] - 1);
count++;
while (true) {
... |
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;
int ans = 0;
bool flag = false;
std::vector<int> v;
v.push_back(b);
v.push_back(b);
v.push_back(b);
do {
flag = true;
sort(v.begin(), v.end());
if (v[0] == a && v[1] == a && v[2] == a) {
flag = false;... |
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,b,c)<(x,x,x,):
new=b+c-1
a,b,c=b,c,new
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... | /* 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
{
Scanner sc = new Scanner(System.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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... |
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 tr[3] = {y, y, y};
int ans = 0;
while (tr[0] != x || tr[1] != x || tr[2] != x) {
for (int i = 0; i < 3; i += 1) {
if (tr[i] == x) continue;
int nxt = tr[(i + 1) % 3];
int prv = tr[(i - 1 + 3)... |
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;
int proc(vector<int> v) {
sort(v.begin(), v.end());
if (v[0] == x) return 0;
v[0] = min(x, v[1] + v[2] - 1);
return 1 + proc(v);
}
int main() {
scanf("%d%d", &x, &y);
vector<int> v(3, y);
printf("%d\n", proc(v));
}
|
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 solve() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
int x, y;
long long k = 0;
cin >> x >> y;
int a[3] = {y, y, y};
while (a[0] != x || a[1] != x || a[2] != x) {
sort(a, a + 3);
a[0] = min(x, a[2] + a[1] - 1);
k++;
}
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... | import java.io.IOException;
import java.util.InputMismatchException;
public class MemoryAndDeEvolution {
public static void main(String[] args) {
FasterScanner sc = new FasterScanner();
int X = sc.nextInt();
int Y = sc.nextInt();
int[] arr = new int[32];
arr[0] = arr[1] = arr[2] = Y;
for (int i = 3... |
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... | y, x = map(int, input().split())
arr = [x, x, x]
count = 0
while True:
if arr[0] >= y:
break
count += 1
arr[0] = min(y, arr[1] + arr[2] - 1)
arr.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... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y, count = 0;
scanf("%d %d", &x, &y);
if (x > y) swap(x, y);
int x1 = x, x2 = x, x3 = x;
while (x1 != y || x2 != y || x3 != y) {
x1 = x2 + x3 - 1;
swap(x1, x2);
swap(x2, x3);
if (x3 > y) x3 = y;
count++;
}
printf("%d\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... | #include <bits/stdc++.h>
using namespace std;
static int x, y;
int main() {
while (scanf("%d%d", &y, &x) != EOF) {
vector<int> v = {x, x, x};
int ans = 0;
while (true) {
if (v[0] == y && v[1] == y && v[2] == y) break;
if (v[1] == y) {
v[0] = y;
} else if (v[1] + v[2] - 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... | import java.util.*;
/**
* This program prints a single integer — the minimum number
* of seconds required for Memory to obtain the equilateral
* triangle of side length y if it starts with the equilateral
* triangle of side length x.
*
* @author Group 5
* @version 1.00 2016/10/26
*/
public class MemoryAndDeEv... |
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 inf_int = 2e9;
long long inf_ll = 2e18;
const double pi = 3.1415926535898;
template <typename T, typename T1>
void prin(vector<pair<T, T1> >& a) {
for (int i = 0; i < a.size(); i++) {
cout << a[i].first << " " << a[i].second << "\n";
}
}
template <typename T, ty... |
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>
template <class T>
inline void rd(T &x) {
char c = getchar();
x = 0;
while (!isdigit(c)) c = getchar();
while (isdigit(c)) {
x = x * 10 + c - '0';
c = getchar();
}
}
using namespace std;
const int N = 111111;
const int MOD = 1e9 + 7;
int a[3];
int main() {
int x, y;
scanf(... |
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.StringTokenizer;
public class _712_C_Memory_and_DeEvolution {
public static void main(String[] args) throws Exception {
InputStream inputStream =
(args.length <= 0) ?
System.in : new FileInputStream(args[0]);
OutputStream outputStream =
(args.length <= 1) ?
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... | """ Python 3 compatibility tools. """
from __future__ import division, print_function
import itertools
import sys
import os
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
input = raw_input
range = xrange
filter = itertools.ifilter
map = itertools.imap
zip = itertools.izip
def is_it_local():
... |
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.Arrays;
import java.util.Scanner;
/**
* Created by Jaydeep on 9/25/2016.
*/
public class Triangle {
public static void main(String[] args) {
long count = 0;
Scanner in = new Scanner(System.in);
long[] triangle = new long[3];
long goal = in.nextInt();
long ... |
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... |
line1=input().split()
x=int(line1[0])
y=int(line1[1])
a,b,c=y,y,y
steps=0
while (a<x or b<x or c<x):
a=b+c-1
steps+=1
a,b,c=min(a,b,c), a+b+c-max(a,b,c)-min(a,b,c), max(a,b,c)
print (steps)
|
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, v = [y] * 3, 0
while a[0] < x:
a[0] = min(x, a[1] + a[2] - 1)
a.sort()
v += 1
print(v) |
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 = 2e5 + 55;
int let[27];
int main() {
int n, ans = 0, x, y, z, m;
cin >> n >> m;
x = y = z = m;
while (1) {
if (x == y && y == z && z == n) break;
if (y >= z) swap(y, z);
if (x >= y) swap(x, y);
x = min(n, z + y - 1);
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... | from sys import stdin
x, y = map(int, stdin.readline().split())
ans, cur = 0, [y, y, y]
while not (cur[0] == cur[1] == cur[2] == x):
ans += 1
cur[0] = min(x, (cur[1] + cur[2]) - 1)
cur.sort()
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 x, y;
cin >> x >> y;
int a = y, b = y, c = y;
int co = 0;
while (true) {
if (a >= x && b >= x && c >= x) {
cout << co;
return 0;
}
co++;
if (co % 3 == 1) {
a = b + c - 1;
} else if (co % 3 == 2) {
b = 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;
class TaskC {
public:
void solve(std::istream& in, std::ostream& out) {
int x, y;
in >> x >> y;
if (x == y)
out << 0;
else {
int res = 0;
int arr[3] = {y, y, y};
while (arr[0] != x or arr[1] != x or arr[2] != x) {
sort(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... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y, a, b, c;
scanf("%d %d", &x, &y);
a = b = c = y;
int cnt = 0;
while (1) {
cnt++;
if (a >= x && b >= x && c >= x) {
printf("%d\n", cnt - 1);
return 0;
} else if (cnt % 3 == 1)
a = b + c - 1;
else if (cnt % 3 =... |
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>
const double PI = acos(-1.0);
const double e = exp(1.0);
const int INF = 0x7fffffff;
;
template <class T>
T gcd(T a, T b) {
return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
return a / gcd(a, b) * b;
}
template <class T>
inline T Min(T a, T b) {
return a < b ? 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... | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, s[3], ans = 0;
cin >> a >> b;
for (int i = 0; i < 3; i++) s[i] = b;
while (s[0] != a || s[1] != a || s[2] != a) {
if (s[2] < a) {
s[2] = s[0] + s[1] - 1;
if (s[2] > a) s[2] = a;
ans++;
}
if (s[1] < a) {
s[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() {
int x, y;
cin >> x >> y;
int a = y, b = y, c = y;
int count = 0;
while (1) {
if (a >= x && b >= x && c >= x) {
break;
}
count++;
if (count % 3 == 1) {
a = b + c - 1;
}
if (count % 3 == 2) {
b = a + c - 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... | x,y = map(int,raw_input().split())
ans = 0
p = [y,y,y]
while True:
if all(t == x for t in p):
break
p.sort()
ans +=1
m = max(p[1]+p[2]-1,1)
if m >= x:
p[0] = x
else:
p[0] = m
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() {
long long int x, y;
cin >> x >> y;
long long int result(0);
long long int y1(y), y2(y), y3(y);
long long int i = 1;
while (y1 < x or y2 < x or y3 < x) {
if (i == 1) {
if (y2 + y3 - 1 > x) {
y1 = x;
} else {
y1 = y2 + ... |
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 C {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan=new Scanner(System.in);
int x=scan.nextInt();
int y=scan.nextInt();
int a=y,b=y,c=y;
int cnt=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;
const long long inf = LLONG_MAX / 1000;
int a[200100];
int i, n, m;
int counter = 0;
bool ok(int a, int b, int c) {
if (a < b + c && b < a + c && c < a + b && max(a, max(b, c)) <= n)
return true;
return false;
}
int main() {
cin >> n >> m;
for (i = 1; i <= 3; 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.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class Third{
static long mod=1000000007;
public static void main(String[] args) throws Exception{
InputReader in = new InputReader(System.in);
PrintW... |
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,os,io
from sys import stdin
from functools import cmp_to_key
from bisect import bisect_left , bisect_right
from collections import defaultdict
def ii():
return int(input())
def li():
return list(map(int,input().split()))
if(os.path.exists('input.txt')):
sys.stdin = open("input.txt","r") ; sys.std... |
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 Solution3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int i,x = sc.nextInt(), y = sc.nextInt();
int arr[] = new int[]{y,y,y};
for(i = 0;arr[0]<x||arr[1]<x||arr[2]<x;i++){
arr[i%3] = arr[(i+1)%3]+arr[(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() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long x, y, c = 0, i = 0;
cin >> x >> y;
long long arr[3];
for (i = 0; i < 3; i++) arr[i] = y;
while (true) {
if (arr[0] == x && arr[1] == x && arr[2] == x) {
cout << c;
retur... |
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() {
ifstream fin("input.txt");
int i, j;
int ans = 0, a, b, c, x, y;
cin >> x >> y;
a = y;
b = y;
c = y;
while (true) {
if (a < b) {
if (a < c) {
a = (b + c) - 1;
ans++;
if (a >= x) {
ans += 2;
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;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return n & two(b); }
inline void set_bit(int& n, int b) { n |= two(b); }
inline void unset_bit(int& n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int 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... | //package c370;
import java.util.Arrays;
import java.util.Scanner;
public class q3
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int x=s.nextInt();
int y=s.nextInt();
int a=y,b=y,c=y;
int co=0;
while(!(a==x && b==x && c==x))
{
// System.out.println(a+" "+b+" "+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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Sa... |
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
ans = 0
while min(a, b, c) != x:
arr = list(sorted([a, b, c]))
arr[0] = min(x, arr[1] + arr[2] - 1)
a, b, c = arr
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 MOD = 1e9 + 7;
const long double PI = 3.14159265358979323846;
struct myCompare {
bool operator()(const std::pair<int, int> &l,
const std::pair<int, int> &r) const {
return l.first < r.first;
}
};
const int MAXN = 1e5 + 3;
int x, y;
void 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... | #include <bits/stdc++.h>
using namespace std;
int ara[5];
int main() {
int x, y, z, cnt, res;
while (cin >> x >> res) {
cnt = 0;
ara[1] = res;
ara[2] = res;
ara[3] = res;
while (ara[1] < x) {
cnt++;
ara[1] = ara[2] + ara[3] - 1;
sort(ara + 1, ara + 4);
}
cout << 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] = [int(x) for x in input().split()]
a, b, c = y, y, y
res = 0
while a != x or b != x or c != x:
res += 1
minimum = min(a, b, c)
if a == minimum:
a = min(b+c-1, x)
elif b == minimum:
b = min(a+c-1, x)
else:
c = min(a+b-1, x)
print(res) |
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 DDDF = 0, DDDS = 0;
bool Sortpair(pair<int, int> a, pair<int, int> b) {
return a.second < b.second;
}
string con(string s, int i) {
string t = "";
for (int k = 0; k < i; k++) t += s[k];
for (int j = (i + 1); j < s.length(); j++) {
t += s[j];
}
return 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... | import java.util.*;
import java.io.*;
public class CodeForces {
public static void main(String[] args) throws IOException {
Reader.init(System.in) ;
PrintWriter writer = new PrintWriter(System.out);
int x = Reader.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... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long x, z, a, b, c, i = 1, y = 0;
cin >> x >> z;
a = b = c = z;
while (1) {
if (i % 3 == 1 && a < x) {
if (c + b < x) {
a = c + b - 1;
} else if (c + b == x)
a = x - 1;
else
a = x;
i++;
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... | import java.io.*;
import java.util.*;
public class CF712C {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int x = Integer.parseInt(st.nextToken());
int y = Integer.p... |
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 res = 0;
int a, b, c;
a = b = c = y;
while (b + c < x) {
a = b;
b = c;
c = a + b - 1;
res++;
}
if (b + c == x)
res += 4;
else if (b + c > x)
res += 3;
printf("%d\n", res);
return... |
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.util.Arrays;
import java.util.StringTokenizer;
public class MemoryAndDeEvolution {
static int x,y;
public static void main(String[] args) throws NumberFormatException, IOException ... |
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, ans = 0;
bool flag;
void dfs(int x, int y, int z) {
if (x == z && x == b) return;
int t[3];
t[0] = x, t[1] = y, t[2] = z;
if (t[0] + t[1] - 1 >= b)
t[2] = b;
else
t[2] = t[0] + t[1] - 1;
++ans;
sort(t, t + 3);
dfs(t[2], t[1], t[0]);
}
int m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.