Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.*;
import java.util.*;
public class C {
public static void solution(BufferedReader reader, PrintWriter writer)
throws IOException {
In in = new In(reader);
Out out = new Out(writer);
int x = in.nextInt(), y = in.nextInt();
int cnt = 0;
int[] a = ne... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
FastScanner in;
PrintWriter out;
static class FastScanner {
BufferedReader br;
StringTokenizer st;
FastScanner(InputStream in) {
br = new BufferedReader(new InputStreamReader(in));
... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | x,y = map(int,input().split())
ans = 0
a=b=c=y
while not (a>=x and b>=x and c>=x):
if ans%3==0:
a = b+c-1
elif ans%3==1:
b = a+c-1
else:
c = a+b-1
ans += 1
print(ans) | PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
bool check(vector<int> a, int y) { return a[0] == y && a[1] == y && a[2] == y; }
int get_sum(vector<int> a) {
int m = *min_element(a.begin(), a.end());
for (int i = 0; i < 3; i++) {
if (a[i] == m) {
for (... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class C {
static class N implements Comparable<N> {
int x, y;
N(int a, int b) {
x = a;
y = b;
}
@Override
public int compareTo(N o) {
return Integer.compare(x, o.x);
}
}
public static void main(String[] args) throws Exc... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.awt.*;
import java.io.*;
import java.util.*;
public class Abc {
public static void main(String[] args) throws Exception {
FastReader sc = new FastReader();
int x=sc.nextInt(),y=sc.nextInt();
int cnt=0,a=y,b=y,c=y;
while (true){
if (Math.min(Math.min(a,b),c)>=... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 |
def triangle(sides, goal):
ordered = sorted(sides)
if ordered[0] == goal and ordered[2] == goal:
return 0
ordered[0] = min(ordered[2]+ordered[1]-1, goal)
return 1 + triangle(ordered, goal)
x,y = map(int,raw_input().split())
print triangle([y,y,y],x)
| PYTHON |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, x, y;
cin >> x >> y;
b = c = a = y;
int lol[4];
lol[0] = lol[1] = lol[2] = y;
int k = 0;
while (lol[0] != x || lol[1] != x || lol[2] != x) {
sort(lol, lol + 3);
lol[0] = min(lol[2] + lol[1] - 1, x);
k++;
}
cout << k <<... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | //package CF;
import java.io.BufferedReader;
import java.io.FileReader;
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 B {
public static void main(String[] args) throws ... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | x,y = map(int,input().split())
if x//2<y:
print(3)
else:
lis=[y]*3
c=0
while max(lis)<x:
a=lis[1]+lis[2]
lis.sort()
lis[0]=a-1
lis.sort()
# print(lis)
c+=1
print(c+2)
| PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 |
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 C {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int x = sc.nextIn... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CF712C {
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] givStr = br.readLine().split(" ");
int x = Integer.par... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import sys
def fastio():
from io import StringIO
from atexit import register
global input
sys.stdin = StringIO(sys.stdin.read())
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.stdout = StringIO()
register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
INF = 10**20
... | PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | 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 P1 {
public static void main(String[] args) throws Exception {
Scanner sc = new Scan... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
int x, y;
int a[3];
int res;
int main() {
scanf("%d %d", &x, &y);
res = 0;
a[0] = a[1] = a[2] = y;
while (1) {
if (a[1] + a[2] - 1 >= x) {
res += 3;
break;
}
a[0] = a[1];
a[1] = a[2];
a[2] = a[0] + a[1] - 1;
res++;
}
printf("%d\n", res);
return ... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int a, b, s, s1, m, n, y;
int main() {
cin >> a >> b;
s = b;
s1 = b;
m += b * 3;
while (s != a || s1 != a || a != b) {
y++;
n = min(min(s, b), s1);
m -= n;
if (n == b) {
if (m - 1 <= a)
b = m - 1, m += m - 1;
else
b = a,... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a[4], b, val1, val2, c, ans = 0;
cin >> val1 >> val2;
a[0] = a[1] = a[2] = val2;
while (a[0] < val1 || a[1] < val1 || a[2] < val1) {
sort(a, a + 3);
a[0] = a[1] + a[2] - 1;
ans++;
}
printf("%d\n", ans);
return 0;
}
| CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.*;
import java.lang.*;
import java.io.*;
public class CodeforcesDiv2_370_Problem3 {
public static void main(String[] args) {
CodeforcesDiv2_370_Problem3 codeforces = new CodeforcesDiv2_370_Problem3();
Scanner scanner = new Scanner(System.in);
int x = scanner.nextInt();
int y = scanner.nextI... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
inline void relax(long long& val, long long newval) {
if (val == -1) {
val = newval;
} else {
val = min(val, newval);
}
}
void main1() {
string s;
getline(cin, s);
map<char, int> count;
for (auto c : s) {
count[c]++;
}
int ans = abs(count['L'] ... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
int ans = 0;
int a[] = {y,y,y};
while(a[0] < x) ... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | a,b=map(int,input().split())
l=[b,b,b]
k=0
while l[0]!=a or l[1]!=a or l[2]!=a :
l[0]=min(a,l[2]+l[1]-1)
l=sorted(l)
k+=1
print(k)
| PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | __author__ = 'choo-choo'
x,y = map(int,raw_input().split())
def checktraingle(points):
if(points[1]>points[2]):
if(points[1]+points[2]-1 < x ):
return [points[2],points[1],points[1]+points[2]-1]
else:
return [points[2],points[1],x]
else :
if(points[1]+points[2]... | PYTHON |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int x = scanner.nextInt();
int y = scanner.nextInt();
// from x --> y
int a, b, c;
a = b = c = y;
int remainLength = 3 * x - 3 * y;
int ans = 0;
while (remainLength > 0)... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int x, y;
string s;
bool isEquilateral(int t[], int x) {
return t[0] == x && t[1] == x && t[2] == x;
}
int main() {
cin >> x >> y;
int t[3];
int steps;
t[0] = y;
t[1] = y;
t[2] = y;
steps = 0;
while (true) {
sort(t, t + 3);
if (t[0] == x && t[2] ==... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.*;
import java.io.*;
public class codeforces
{
public static void main(String[] args)
{
InputReader in = new InputReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
int x = in.nextInt();
int y = in.nextInt();
int a = y, b = y, c = y, max, ... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
#pragma warning(disable : 4996)
int x, y, a, b, c, ans = 0;
scanf("%d%d", &x, &y);
int ar[3] = {y, y, y};
while (ar[0] != x || ar[1] != x || ar[2] != x) {
ar[0] = min(x, ar[1] + ar[2] - 1);
sort(ar, ar + 3);
ans++;
}
printf("%d", ans);
... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.*;
public class div2_370C {
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner sc = new Scanner(System.in);
long x = sc.nextLong();
long y = sc.nextLong();
int laps = 0;
long[] arr = {y,y,0};
for(;;){
if(x>arr[1]){
arr[2]=arr[0]+arr[1]-1;
arr[0]=ar... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MXN = (int)1e5 + 7;
int a[3];
int main(void) {
int x, y;
scanf("%d %d", &x, &y);
int ans = 0;
for (int i = 0; i < 3; i++) a[i] = y;
while (a[0] != x) {
a[0] = min(x, a[2] + a[1] - 1);
sort(a, a + 3);
ans++;
}
printf("%d\n", ans);
return... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | s, t = map(int, input().split())
s = [s, s, s]
t = [t, t, t]
it = 0
i = 0
while s[i] != t[i]:
t[i] = min(s[i], t[(i+1)%3] + t[(i+2)%3] - 1)
it += 1
i = (i+1)%3
print(it)
| PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;
/**
*
* @author DeLL
*/
public class Triangle {
public static void main(String args[]){
Scanner in= new Scanner(System.in);
int n=in.nextInt();
int m=in.nextInt();
int... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.*;
public class Problem0712c {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int y = sc.nextInt();
int x = sc.nextInt();
int side1 = x;
int side2 = x;
int side3 = x;
int time = 0;
while(Math.max(Math.max... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | x,y=map(int,raw_input().split())
v=[y]*3
t=0
while v[0]<x:
v[0]=min(x,v[1]+v[2]-1)
v.sort()
t+=1
print t
| PYTHON |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.*;
public class C{
public static void func(int x,int y){
int arr[]={y,y,y};
int i=0;
int count=0;
int sum=y+y;
while(true){
if(sum-1<=x){
arr[i]= sum-1;
i++;
//System.out.println("hi");
... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | x,y=map(int,input().split(' '))
ans=0
A=[y]*3
while(sum(A)<x*3):
A.sort()
A[0]=min(x,A[1]+A[2]-1)
ans+=1
print(ans)
| PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[3], x, y, cnt;
bool judge() {
for (int i = 0; i < 3; ++i)
if (a[i] != x) return false;
return true;
}
int main() {
scanf("%d%d", &x, &y);
a[0] = a[1] = a[2] = y;
while (!judge()) {
++cnt;
sort(a, a + 3);
a[0] = min(x, a... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | goal, init = [int(n) for n in raw_input().split(' ')]
a = b = c = init
count = 0
while a < goal or b < goal or c < goal:
a, b, c = sorted((a, b, c))
a = min(b + c - 1, goal)
count += 1
print count
| PYTHON |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int TAM = 300000 + 50;
const long long MOD = 1000000007LL;
int x, y;
int main() {
scanf("%d%d", &x, &y);
vector<int> v(3, y);
int holi;
int i = 0;
int r = 0;
while (v[0] != x || v[1] != x || v[2] != x) {
switch (i) {
case 0:
v[0] = min(x,... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
int x, y;
cin >> x >> y;
int a, b, c, t = 0;
a = b = c = y;
while (1) {
if (a >= x and b >= x and c >= x) {
cout << t;
return 0;
}
if (t % 3 == 0)
a = b + c - 1... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int x, y;
cin >> x >> y;
int a[3]... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
int a[3];
for (int i = 0, _b = (2); i <= _b; i++) a[i] = y;
int res = 0;
while (a[0] < x) {
a[0] = min(a[1] + a[2] - 1, x);
res++;
sort(a, a + 3);
}
cout << res;
}
| CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.*;
import java.math.*;
import java.io.*;
import java.text.DecimalFormat;
import java.math.BigInteger;
public class Main{
//static int d=20;
static long mod=1000000007 ;
//static HashMap<String,... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MODA = 1000003;
inline void print(char pt) { printf("%c\n", pt); }
inline void print(int pt) { printf("%d\n", pt); }
inline void print(long long pt) { printf("%I64d\n", pt); }
inline void print(double pt) { printf("%.20f\n", pt); }
inline void print(char pt[]) { p... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int t[3], temp = 0, i = 0, prod = b - 1, count = 0;
t[0] = t[1] = t[2] = b;
while (temp < 3) {
if (t[i] >= a) {
temp++;
} else {
t[i] = t[(i + 1) % 3] + t[(i + 2) % 3] - 1;
count++;
}
i = (i +... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | x, y = map(int, input().split())
a = [y, y, y]
count = 0
while not all(map(lambda _: _ == x, a)):
a[0] = min(a[1] + a[2] - 1, x)
a.sort()
count += 1
print(count)
| PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.Scanner;
import java.util.Arrays;
public class Main {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
while (sc.hasNextInt()) {
int x;
x = sc.nextInt();
int y;
y = sc.nextInt();
int[] N = { y, y, y };
int time = 0;
while (N[... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.Arrays;
import java.util.Scanner;
public class p712C
{
public static void main( String[] args )
{
Scanner s = new Scanner( System.in );
int y = s.nextInt(), x = s.nextInt();
s.close();
int[] sides = { x, x, x };
int curSide = 0;
int seconds = 0;
while ( sides[ 0 ] != y || sides[ ... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int y, x, a[3];
int main() {
while (cin >> y >> x) {
a[0] = a[1] = a[2] = x;
int cnt = 0;
while (a[0] < y || a[1] < y || a[2] < y) {
sort(a, a + 3);
a[0] = a[1] + a[2] - 1;
++cnt;
}
cout << cnt << endl;
}
return 0;
}
| CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int x, y, a, b, c, cnt;
void s() {
if (a > b) swap(a, b);
if (a > c) swap(a, c);
if (b > c) swap(b, c);
}
int main(void) {
scanf("%d%d", &x, &y);
if (x > y) swap(x, y);
a = x, b = x, c = x;
while (a != y) {
cnt++;
a = min((b + c) - 1, y);
s();
}
... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.Reader;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.BufferedReader;
import java.io.FileReader;
i... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | /*
* Code Author: Akshay Miterani
* DA-IICT
*/
import java.io.*;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
public class MainY {
static double eps=(double)1e-6;
static long mod=(int)1e9+6;
public static void main(String args[]){
InputReader ... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int x, y;
int a[4];
int main() {
scanf("%d%d", &x, &y);
a[1] = a[2] = a[3] = y;
int ans = 0;
while (a[1] != x || a[2] != x || a[3] != x) {
ans++;
int id = 1, sum = a[1];
for (int i = 2; i <= 3; i++) {
if (a[i] < a[id]) id = i;
sum += a[i];
... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int x, y, a[3], cnt = 0;
int main() {
scanf("%d%d", &x, &y);
a[0] = a[1] = a[2] = y;
while (1) {
sort(a, a + 3);
if (a[0] == x) break;
cnt++;
a[0] = min(x, a[1] + a[2] - 1);
}
printf("%d\n", cnt);
return 0;
}
| CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.Scanner;
public class P712C
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int x = scan.nextInt(), y = scan.nextInt();
int[] len = new int[3];
int sec = 0, last = -1;
len[0]=len[1]=len[2] = y;
while (last != sec)
{
last = sec;
for (int i = 0; i ... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | x,y=list(map(int,input().split()))
a=[y,y,y]
c=0
while 1>0:
if x<=(a[0]+a[1]-1):
print(c+3)
break
else:
a[-1]=a[0]+a[1]-1
c+=1
a.sort(reverse=True) | PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int read() {
int x = 0, f = 0;
char ch = 0;
while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
return f ? -x : x;
}
void write(int x) {
if (x < 0) putchar('-'), x = -x;
if (x >= 10) w... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | 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.Collections;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.*;
import java.lang.*;
import java.math.*;
public class CF712C {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
int x = s.nextInt();
int y = s.nextInt();
int res = devolve(x, y);
System.out.println(res);
}
public static int devolve(int x, in... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | y, x = map(int, raw_input().split())
t = [x, x, x]
step_count = 0
while not all(i == y for i in t):
t.sort()
t[0] = min(y, t[2] + t[1] - 1)
step_count += 1
print step_count
| PYTHON |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | /**
* Created by abhishek on 8/4/2016.
*/
import java.util.*;
import java.io.*;
public class Main {
static int ans = 0;
static void dfs(int array[],int x) {
if (array[0] == x) return;
int temp = Math.min(array[1] + array[2] - 1, x);
array[0] = array[1];
array[1] = array[2];
... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | x,y = map(int,input().split())
s = [y,y,y]
k = 0
while sum(s)!=x*3:
mi = min(s)
ma = max(s)
sr = sum(s)-ma-mi
a = sum([sr,ma])-1
if a>x:
a = x
s[s.index(mi)] = a
k+=1
print(k)
| PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.*;
import java.io.*;
public class Main {
public static long mod= (long) (1e9 +7);
public static void main(String args[]){
InputReader s= new InputReader(System.in);
OutputStream outputStream= System.out;
PrintWriter out= new PrintWriter(outputStream);
int x= s.nextInt();
int y= s.nextI... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.*;
import java.io.*;
public class Test {
static int heaps = 0;
public static void main(String args[]){
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
long x = in.nextLong();
long y = in.nextLong();
long arr[] = new long[3];
long count = 0;
arr[0] = ... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
public class Main {
pu... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | y, x = map(int, input(). split())
a = x; b = x; c = x; k = 0
while a < y or b < y or c < y:
if a < c+b-1:
a = c+b-1
k += 1
if a >= y and b >= y and c >= y:
break
if b < a+c-1:
b = a+c-1
k += 1
if a >= y and b >= y and c >= y:
break
if c... | PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, k, count = 0, n, a, b, a1[3], temp;
cin >> a >> b;
a1[0] = a1[1] = a1[2] = b;
while (1) {
if (a1[0] == a && a1[1] == a && a1[2] == a) break;
sort(a1, a1 + 3);
temp = a1[1] + a1[2] - 1;
if (temp < a)
a1[0] = temp;
else... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 2000010;
int main() {
vector<int> a(3);
int x, y;
while (cin >> x >> y) {
for (int i = 0; i < 3; i++) {
a[i] = y;
}
int res = 0;
while (true) {
sort(a.begin(), a.end());
if (a[0] == x) break;
res++;
a[0] = mi... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> y >> x;
int a[3] = {x, x, x};
int ans = 0;
while (a[0] < y) {
a[0] = min(y, a[1] + a[2] - 1);
sort(a, a + 3);
ans++;
}
cout << ans << endl;
}
| CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | def get_next(T):
[a,b,c] = sorted(T)
return [b,c,b+c-1]
if __name__ == '__main__':
y,x = [int(a) for a in input().split()]
T = [x,x,x]
# print(T)
i = 0
while max(T) < y:
T = get_next(T)
# print(T)
i+=1
print(2+i) | PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.*;
import java.io.*;
public class Main {
public static void main (String args[])
{
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int x = in.nextInt();
int y = in.nextInt();
int arr[] = new int[3];
... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.Arrays;
import java.util.Scanner;
/**
* Created by gobbles on 10.09.16.
*/
public class codeforce3 {
private static Scanner is = new Scanner(System.in);
public static void main(String[] args) {
int real_len = is.nextInt();
int aim_len = is.nextInt();
int[] edges = ne... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | t, f = map(int, input().split())
s = [f] * 3
count = 0
while sum(s) < 3*t:
s.sort()
s[0] = min(t, s[1]+s[2] - 1)
count += 1
print(count)
| PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | x, a = map(int, input().split())
c = b = a
i = 0
while a < x:
[a,b,c] = sorted([b,c,c+b-1])
i+=1
print(i) | PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y, count = 0;
cin >> x >> y;
int a[3], i = 0;
for (int i = 0; i < 3; i++) a[i] = y;
while (a[0] != x || a[1] != x || a[2] != x) {
count++;
if (i == 0) {
a[i] = min(x, a[1] + a[2] - 1);
i++;
} else if (i == 1) {
a[i... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | read=input()
read=read.split(" ")
a=[0]*4
n=int(read[0])
m=int(read[1])
a[1]=m
a[2]=m
a[3]=m
def mysort():
for i in range(1,4):
for j in range(i,4):
if a[i]>a[j]:
a[i],a[j]=a[j],a[i]
return
def getans():
t=0
if n==m:
return 0
while 0==0:
mysort();
t=t+1;
if a[2]+a[3]-1<=n :
a[1]=a[2]+a[3]-1
e... | PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.Arrays;
import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x = scan.nextInt() + 1;
int y = scan.nextInt();
int[] sides = new int[3];
int ans = 0;
Arrays.fill(sides, y);
while (true) {
Arrays.sort(sides);
... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | n,k=map(int,input().split())
x=k
y=k
z=k
turns=0
while True:
if x>=n and y>=n and z>=n:
print(turns)
break
turns+=1
if turns%3==1:
x=y+z-1
if turns%3==2:
y=z+x-1
if turns%3==0:
z=x+y-1
| PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000 + 7;
const double esp = 1e-13;
const long double PI = acos(-1.0);
long long nhan(long long x, long long y, long long m) {
long long ans = 0;
while (y) {
if (y % 2) ans = (ans + x) % m;
x = x * 2 % m;
y /= 2;
}
return ans;... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int x, y;
cin >> x >> y;
long long int a, b, c;
a = y;
b = y;
c = y;
long long int count = 0;
while (1) {
if (a >= x && b >= x && c >= x) {
cout << count << endl;
break;
}
count++;
if (count % 3 == 1) {
... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Scanner;
public class Main {
static FasterScanner sc;
//static ArrayList<Integer>[] arr;
//static boolean[] b;
public ... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int a[3];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int x, y;
cin >> x >> y;
a[0] = a[1] = a[2] = y;
int m = 0;
while (a[0] + a[1] + a[2] != 3 * x) {
sort(a, a + 3);
++m;
a[0] = min(x, a[1] + a[2] - 1);
}
cout << m << "\n";
return 0;
... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int x, y, ans;
int a[3];
inline void ssort() {
if (a[0] > a[1]) swap(a[0], a[1]);
if (a[0] > a[2]) swap(a[0], a[2]);
if (a[1] > a[2]) swap(a[1], a[2]);
}
inline int solve() {
a[0] = a[1] = a[2] = y;
int ans = 0;
while (!(a[0] == a[1] && a[1] == a[2] && a[0] == x... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main() {
int x, y;
cin >> x >> y;
for (int i = 0; i < 3; i++) v.push_back(y);
int ans = 0;
while (true) {
sort(v.begin(), v.end());
if (v[0] == v[2] && v[0] == x) break;
v[0] = v[1] + v[2] - 1;
if (v[0] > x) v[0] = x;
ans++;
... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #!/usr/bin/env python
x, y = (int(i) for i in raw_input().split())
if x > y:
x, y = (y, x)
a, b, c = (x, x, x)
i = 0
while a != y or b != y or c != y:
a = min(b + c - 1, y)
new_a = min(a, b, c)
new_c = max(a, b, c)
a, b, c = (new_a, a + b + c - new_a - new_c, new_c)
i += 1
print i
| PYTHON |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | line = raw_input().split(" ")
a, b = int(line[0]), int(line[1])
x, y, z = b, b, b
steps = 0
while True:
if z == a:
break
steps += 1
z = min(a, x-1+y)
x, y, z = z, x, y
print steps
| PYTHON |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.util.Arrays;
import java.util.Scanner;
public class C
{
public static void main(String[] args) throws Exception
{
Scanner s = new Scanner(System.in);
int x = s.nextInt(), y = s.nextInt();
int[] arr = {y,y,y};
int cnt = 0;
while (true)
{
Arrays.sort(arr);
if (arr[0] == x) break;
arr[0... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
const int MAXN = 1e4 + 10;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double pi = acos(-1.0);
const double eps = 1e-6;
int dx[] = {0, -1, 0, 1};
int dy[] = {1, 0, -1, 0};
int x, y;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
int cnt = 0;
int a = y, b = y, c = y;
while (a != x || b != x || c != x) {
if (a != x) {
a = min((b + c - 1), x);
cnt++;
}
if (b != x) {
b = min((a + c - 1), x);
cnt++;
}
if (c != x)... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | //package pkg712c;
import java.util.Scanner;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int x, y, count = 0;
int[] num = new int[3];
Scanner scan = new Scanner(System.in);
x = scan.nextInt();
y = scan.nextInt();
for (int i... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int num[1 << 18];
char str[20];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
;
int x, y;
cin >> x >> y;
int a, b, c, ans = 0;
a = b = c = y;
while (a < x) {
swap(a, b);
swap(b, c);
c = a + b - 1;
ans++;
}
cout << a... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
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 G {
public static void main(... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
scanf("%d%d", &x, &y);
int arr[3];
for (int i = 0; i < 3; i++) arr[i] = y;
int cnt = 0;
while (true) {
int sum = arr[1] + arr[2];
if (sum - 1 >= x)
arr[0] = x;
else
arr[0] = sum - 1;
sort(arr, arr + 3);
cnt+... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | y, x = map(int, input().split())
def f(a):
a = sorted(a)
if a[0] == y:
return 0
a[0] = min(sum(a[1:]) - 1, y)
return 1 + f(a)
print(f([x, x, x]))
| PYTHON3 |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
long long suf(long long x) { return (x * (x + 1)) / 2; }
vector<vector<pair<int, int> > > adj;
const long long mod = 1e9 + 7, oo = 1e18;
int n, m, x, y, z;
int main() {
string s;
while (cin >> x >... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 10;
const int inf = (int)1e9 + 10;
int solve(int a, int b, int c, int A) {
int mn = min(a, min(b, c));
if (mn == A) return 0;
if (mn == a)
return solve(min(b + c - 1, A), b, c, A) + 1;
else if (mn == b)
return solve(a, min(a + c - 1,... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long a, b, sol, i, fi, se, th, temp;
priority_queue<long long> Q;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> a >> b;
sol = 0;
for (i = 0; i < 3; i++) {
Q.push(b);
}
while (true) {
fi = Q.top(), Q.pop();
se = Q.top(), Q.pop();... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int a[4];
int x, y;
bool check() {
if (a[0] == x && a[1] == x && a[2] == x) return true;
return false;
}
int main() {
scanf("%d%d", &x, &y);
a[0] = a[1] = a[2] = y;
int res = 0;
while (!check()) {
res++;
sort(a, a + 3);
int minn = min(x, a[1] + a[2] ... | CPP |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class C370 {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st ... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.*;
import java.util.*;
public class Main{
private static InputReader in = new InputReader(System.in);
public static void main(String args[]) {
int n = in.readInt(), m= in.readInt();
int a = m, b = m, c = m,op=0;
while(a<n || b<n || c<n) {
if(a<=b && a<=c) {
a = Math.min(b+c-1,n);
}else... | JAVA |
712_C. Memory and De-Evolution | 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 triangle such th... | 2 | 9 | import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class C {
public static void main(String... args) throws Exception {
FastScan sc = new FastScan(new BufferedReader(new InputStr... | JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.