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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
int ans = 0;
int B[3];
B[0] = y;
B[1] = y;
B[2] = y;
while (!(B[0] == x && B[1] == x && B[2] == x)) {
if (ans % 3 == 0) {
B[0] = min(x, B[1] + B[2] - 1);
} else if (ans % 3 == 1) {
B[1] = min(x, B[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.io.*;
public class C {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x = scan.nextInt();
int y = scan.nextInt();
int[] a = new int[55];
a[1] = 1;a[2] = 2;
for(int i = 3;i<=54;i++){
a[i] = a[i-1]+a[i-2];
}
int k = 0;
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 | /**
* Created by naeem on 9/24/16.
*/
import java.util.*;
import java.io.*;
public class C {
public static void main(String[] args) throws IOException {
// Scanner file = new Scanner(new File("c.txt"));
Scanner file = new Scanner(System.in);
String[] parts = file.nextLine().split(" ");
... | 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())
a = [y, y, y]
tot = 0
got = 0
while True:
for i in xrange(3):
a[i] = a[(i + 1)%3] + a[(i + 2)%3] - 1
#print a[i], a[(i+1)%3], a[(i+2)%3]
if a[i] > x:
a[i] = x
tot += 1
if (a[0] == a[1] and a[1] == a[2] and a[2] == x):
got = 1
break
if got == 1:
break
p... | 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.*;
import java.io.*;
import java.math.*;
public class C{
static int x,y,res;
static int raise(int a[],int g){
int rs=0;
while(true){
Arrays.sort(a);
if (a[0]>=g) break;
rs++;
a[0]=Math.min(g,a[1]+a[2]-1);
}
return rs;
}
static void MainMethod()throws Exception{
x=reader.nex... | 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 Codeforces{
public static void main(String[] args) throws IOException{
Scan scan = new Scan();
int m = scan.nextInt();
int a = scan.nextInt(), b = a, c = a;
int counter = 0;
while(a < m || b < m ... | 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.InputStream;
import java.io.InputStreamReader;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class C {
public static boolean valid(int a, int b , int c){
return a+b>c && a+c>b && b+c>a;
}
static int 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 | a,b=input().strip().split(' ')
a,b=(int(a),int(b))
l=[b,b,b]
ans=0
while l!=[a,a,a]:
l.sort()
#print(l)
l[0]=min(l[1]+l[2]-1,a)
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 | L=map(int, raw_input().split())
def maxInc(temp, x, res):
if [x]==list(set(temp)):
return res
else:
a=max(temp)
c=min(temp)
b=sum(temp)-a-c
c=min(a+b-1, x)
return maxInc([a, b, c], x, res+1)
x=max(L)
y=min(L)
temp=[y, y, y]
print maxInc(temp, x, 0)
| 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>
const int N = 1e5 + 1;
using namespace std;
long long x, y;
long long a, b, c;
int main() {
std ::ios ::sync_with_stdio(false);
cin >> x >> y;
long long ans = 0;
a = b = c = y;
while (a != x || b != x || c != x) {
ans++;
if (a > b) swap(a, b);
if (b > c) swap(b, c);
if... | 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::sync_with_stdio(false);
cin.tie(0);
int x, y;
cin >> x >> y;
vector<int> len = {y, y, y};
int ans = 0;
while (len[0] < x || len[1] < x || len[2] < x) {
if (ans % 3 == 0) {
len[0] = len[1] + len[2] - 1;
}
if (ans % 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.*;
import java.util.*;
public class Template implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFoundException {
try {
in = new BufferedReader(new FileReader("input.txt"));
o... | 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 | s = raw_input()
x = int(s.split()[0])
y = int(s.split()[1])
t = [y for i in range(3)]
n = 0
while True:
t = sorted(t)
if t[0] == x:
break
t[0] = t[1] + t[2] - 1
n += 1
if t[0] > x:
t[0] = x
print n
| 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.io.*;
import java.util.*;
import java.text.DecimalFormat;
public class Dfs {
public static void main(String[] args)throws Exception {
reader in = new reader(System.in);
int a=in.nextInt();
int m=in.nextInt();
int x =m;int y=m;int z=m;
int count =0;
while(x!=a||y!=... | 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;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.StringTokenizer;
public class Solution123{
static int coun =... | 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 long long maxn = 200005;
const long long MOD = 1e9 + 7;
void solve() {
long long x, y;
cin >> x >> y;
long long a[3];
a[0] = a[1] = a[2] = y;
long long tm = 0;
while (1) {
a[0] = min(x, a[1] + a[2] - 1);
tm++;
sort(a, a + 3);
if (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 | 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,b,c;
a=b=c=y;
boolean a_flag,b_flag,c_flag;
a_flag=b_flag=c_flag=true;
int ans=0;
while( a_flag || b_flag || c_flag)
{
if(a_flag &... | 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.Scanner;
/* ========== ========== ========== */
// Author - Vamsi Sangam //
/* ========== ========== ========== */
public class MemoryAndDeevolution {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int x = s.nextInt();
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 main() {
int n, m;
int a, b, c;
int pos;
int cot = 0;
cin >> n >> m;
a = m, b = m, c = m;
while (a != n || b != n || c != n) {
if (a != n) {
int pos1;
for (int i = 1; i <= n; i++) {
if ((a + i) + b > c && (b + c) > (a + i) && (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 ra() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return x * f;
}
int e, s, x, y, z, ans;
int main... | 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 TAM = 300000 + 50;
const long long MOD = 1000000007LL;
int x, y;
int main() {
scanf("%d%d", &x, &y);
vector<int> v(3, y);
int i = 0;
int r = 0;
while (v[0] != x || v[1] != x || v[2] != x) {
switch (i) {
case 0:
v[0] = min(x, v[1] + v[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 | mystring = raw_input()
x, y = (map(str.strip, mystring.split(' ')))
#print x, y
x, y = [int(x), int(y)]
a, b, c = y, y, y
turns = 0
while True:
if a >= x and b >= x and c >= x:
print turns
break
turns += 1
if turns%3 == 1:
a = b+c-1
if turns%3 == 2:
b = a+c-1
if turn... | 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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
public class C {
//IO
static BufferedReader f;
static PrintWriter out;
static StringTokenizer st;
final 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 | def get_next(T):
[a,b,c] = sorted(T)
return [b,c,b+c-1]
def main():
y,x = [int(s) for s in input().split()]
T = [x,x,x]
i = 0
while max(T) < y:
T = get_next(T)
i += 1
print(2+i)
main()
| 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, y = map(int, input().split())
cur = [y, y, y]
count = 0
while cur[0] < x:
cur[0] = cur[1] + cur[2] - 1
cur.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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y, i, j;
long long ans = 0;
cin >> x >> y;
swap(x, y);
multiset<int> second;
second.insert(x);
second.insert(x);
second.insert(x);
while (second.size() > 0) {
int i = 0, a[5];
for (set<int>::iterator it = second.begin(); it != 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int a, b;
cin >> a >> b;
int t[3] = {b, b, b};
int ans = 0;
while (t[0] != a || t[1] != a || t[2] != a) {
ans++;
sort(t, t + 3);
t[0] = min(a, t[2] + t[1] - 1);
}
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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, d, e, p = 0, cnt = 0, q;
scanf("%d%d", &a, &b);
c = b;
d = b;
e = b;
while (p != 3) {
cnt++;
q = (d + e) - 1;
c = d;
d = e;
e = q;
if (e >= a) e = a, p++;
}
printf("%d", 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 | initial, final = map(int, input().split())
arr = [final] * 3
ans = 0
while sum(arr) < 3*initial:
arr.sort()
arr[0] = min(initial, arr[1]+arr[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 = 1e6 + 7;
struct tri {
int d[3];
void init() { sort(d, d + 3); }
} S, T;
int main() {
int x, y;
scanf("%d%d", &x, &y);
if (x > y) swap(x, y);
S.d[0] = S.d[1] = S.d[2] = x;
T.d[0] = T.d[1] = T.d[2] = y;
int cnt = 0;
while (S.d[0] != y) {
in... | 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.*;
import java.util.*;
public class main {
public static void main(String[] args) {
InputReader sc=new InputReader(System.in);
int n=sc.nextInt();
//while(n<30){
int m=sc.nextInt();
if(m<n){
int t=m;
m=n;
n=t;
}
... | 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.Arrays;
import java.util.StringTokenizer;
public class Memory {
public static void main(String[] args) throws IOException, InterruptedException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int x=sc.nextInt();
int y=sc.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 | n, m=map(int, input().split())
ans=0
t=[m]*3
while t!=[n]*3:
t=sorted(t[1:]+[min(t[1]+t[2]-1, n)])
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 | import java.io.*;
import java.util.*;
/*
* Heart beats fast
* Colors and promises
* How to be brave
* How can I love when I am afraid to fall...
*/
public class Main
{
static final long mod=1000000007;
static final double eps=1e-8;
static final long inf=100000000000000000L;
static final boolean debu... | 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, b, c, n, m, t;
int main() {
cin >> n >> m;
a = b = c = m;
while (1) {
if (a < n) {
a = min(c + b - 1, n);
t++;
}
if (b < n) {
b = min(a + c - 1, n);
t++;
}
if (c < n) {
c = min(a + b - 1, n);
t++;
}
... | 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;
void abrir_entrada() {}
int main() {
int x, y;
cin >> y >> x;
int sol = 0;
int a[3];
for (int i = 0; i < 3; i++) a[i] = x;
while (a[2] < y) {
a[2] = a[0] + a[1] - 1;
swap(a[0], a[1]);
swap(a[0], a[2]);
sol++;
}
cout << sol << 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 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
ll arr[3];
int main() {
ll x, y;
cin >> x >> y;
for (int i = 0; i < 3; ++i) {
arr[i] = y;
}
int moves = 0;
while (arr[0] != x || arr[1] != x || arr[2] != x) {
ii best(10000000, -1);
for (int i = 0; i < 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() {
std ::ios ::sync_with_stdio(false);
int x, y;
while (cin >> x >> y) {
x ^= y;
y ^= x;
x ^= y;
int i = 0;
int a = x;
int b = 2 * x - 1;
while (b < y) {
int t = b;
b = a + b - 1;
a = t;
i++;
}
cout... | 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.*;
import java.util.*;
public class Codeforces712C {
public static int solve(int[] sides, int goal) {
if(sides[0] == goal)
return 0;
else {
int[] newT = new int[3];
newT[0] = sides[1];
newT[1] = sides[2];
newT[2] = Math.min(goal, sides[1] + sides[2] - 1);
return 1 + solve(newT, go... | 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())
besta=y
bestb=y
bestc=y
time=0
while True:
if besta>=x and bestb>=x and bestc>=x:
print(time)
break
time+=1
if time%3==1:
besta=bestb+bestc-1
elif time%3==2:
bestb=besta+bestc-1
elif time%3==0:
bestc=besta+bestb-1
#print("Statu... | 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.*;
import java.util.*;
public class C712 {
public static void main(String[] args) throws IOException {
input.init(System.in);
PrintWriter out = new PrintWriter(System.out);
int x = input.nextInt(), y = input.nextInt();
int a = y, b = y, c = y;
int res = 0;
while(a != x)
{
//System.out.println(a+... | 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[3];
int main() {
cin >> X >> Y;
if (X > Y) swap(X, Y);
if (X == Y) {
cout << 0;
return 0;
}
A[0] = A[1] = A[2] = X;
int y_count = 0;
int i = 0;
while (y_count != 3) {
A[i % 3] = min(A[0] + A[1] + A[2] - A[i % 3] - 1, Y);
if (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.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
public static void main(String[] args) ... | 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;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class D2P3 {
/**
* How to read input in Java β tutorial <br />
* By Flatfoot<br />
* http://codeforces.com/blog/entry/7018
*/
static class FastSca... | 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())
l1=[a,a,a]
l2=[b,b,b]
ct=0
if a==b:
print(0)
else:
while max(l2)!=a:
l2.remove(min(l2))
s=sum(l2)
d=abs(l2[0]-l2[1])
if d<a<s:
l2.append(a)
else:
l2.append(s-1)
ct+=1
print(ct+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 | #include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y) {
long long int temp;
if (y == 0) return 1;
temp = power(x, y / 2) % 1000000007;
if (y % 2 == 0)
return (temp * temp) % 1000000007;
else {
if (y > 0)
return (((x * temp) % 1000000007) * temp) % 10... | 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())
assert y < x
it = 0
a, b, c = y, y, y
while True:
assert a >= c >= b
assert a + b > c
assert a + c > b
assert b + c > a
b = a + c - 1
assert a + b > c
assert a + c > b
assert b + c > a
it += 1
if b >= x:
b = x
break
a, b, ... | 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 | def f(n, m):
ans=0
t=[m]*3
while t!=[n]*3:
t=sorted(t[1:]+[min(t[1]+t[2]-1, n)])
ans+=1
return ans
def g(n, m):
ans=0
t=[n]*3
while t!=[m]*3:
t=sorted(t[:2]+[max(t[1]-t[0]+1, m)])
ans+=1
return ans
n, m=map(int, input().split())
print(min(f(n, m), g(n, m))... | 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 | a,b = map(int,raw_input().split())
c = 2*b-1
i =2
while c<a:
b,c = c,b+c-1
i+=1
#print a,c
print i+1
| 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 y, x;
while (~scanf("%d%d", &y, &x)) {
int a[5];
for (int i = 0; i < 3; i++) a[i] = x;
int ans = 0;
while (1) {
int flag = 1;
for (int i = 0; i < 3; i++)
if (a[i] < y) flag = 0;
if (flag) break;
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 | x,y=map(int,input().split())
a,b,c=y,y,y
k=0
while a!=x:a,b,c=sorted([min(x,b+c-1),b,c]);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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
int besta = y, bestb = y, bestc = y;
int turns = 0;
while (true) {
if (besta >= x && bestb >= x && bestc >= x) {
cout << turns << endl;
break;
}
turns++;
if (turns % 3 == 1) besta = bestb + bestc - ... | 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())
s = [y,y,y]
k = 0
while sum(s)!=x*3:
minn = min(s)
maxx = max(s)
sr = sum(s)-maxx-minn
a = sum([sr,maxx])-1
if a>x:
a = x
s[s.index(minn)] = 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.Arrays;
import java.util.Scanner;
public class Round370C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
int y = in.nextInt();
int[] triangle = new int[3];
Arrays.fill(triangle, y);
int count = 0;
int round = 2;
while (tri... | 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 | from math import sqrt
import sys
x, y = [int(i) for i in input().split()]
a = y
b = y
c = y
count = 0
while a != x or b != x or c != x:
min_side = min(min(a, b), c)
max_side = max(max(a, b), c)
mid_side = a+b+c-max_side-min_side
new_side = min(max_side + mid_side - 1, x)
a = mid_side
b = max_si... | 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 m[5];
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (a > b) swap(a, b);
m[0] = m[1] = m[2] = a;
int res = 0;
while (m[0] < b || m[1] < b || m[2] < b) {
sort(m, m + 3);
m[0] = (m[1] + m[2] - 1);
res++;
}
printf("%d\n", res);
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 | #!/usr/bin/env python
#-*-coding:utf-8 -*-
x,y=map(int,input().split())
N=3
L=N*[y]
y=i=0
while x>L[i]:
j=(1+i)%N
L[i]=L[(i-1)%N]-1+L[j]
i=j
y+=1
print(y)
| 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 | def read(t=None):
string = raw_input()
return string if t is None else [t(x) for x in string.split()]
def printl(l):
for x in l:
print x,
print
if __name__ == "__main__":
a, b = read(int)
t = [b for i in range(3)]
n = 0
while t[2] != a:
#print t
t[0] = min(t[1]+t[2]-1, a)
n += 1
t = sorted(t)
prin... | 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 | n, m=map(int, input().split())
ans=0
t=[m]*3
while t!=[n]*3:
t=t[1:]+[min(t[1]+t[2]-1, n)]
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 | from sys import stdin,stdout,setrecursionlimit,maxint,exit
#setrecursionlimit(2*10**5)
def listInput():
return map(long,stdin.readline().split())
def printBS(li):
for i in xrange(len(li)-1):
stdout.write("%d "%li[i])
stdout.write("%d\n"%li[-1])
def sin():
return stdin.readline().rstrip()
x,y=listInput()
#think th... | 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>
long long int gcd(long long int a, long long int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
long long int exp(long long int x, long long int y, long long int mod) {
long long int res = 1;
x = x % mod;
while (y > 0) {
if (y & 1) res = (res * x) % mod;
y = y >> 1;
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 | x, y = [int(s) for s in raw_input().split()]
t = [y, y, y]
ans = 0
while t[0] != x :
ans += 1
t[0] = min(x, t[1] + t[2] - 1)
t.sort()
print ans
| 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;
float time_taken(float x1, float y1, float x2, float y2, float s) {
return sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2)) / s;
}
int bs_lessthan(int a[], int low, int high, int n, int key) {
int mid = (low + high) / 2;
if (low > high) return -1;
if ((mid == n - 1 && 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;
void solve() {
long long int a, b;
cin >> a >> b;
vector<long long int> ar(3, b);
long long int cnt = 0;
while (1) {
if (ar[0] >= a && ar[1] >= a && ar[2] >= a) {
cout << cnt << "\n";
break;
}
cnt++;
if (cnt % 3 == 0) ar[0] = ar[1] + ar... | 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.*;
import java.util.*;
import java.lang.*;
public class Rextester{
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
br.close();
... | 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 n, m;
int x[4];
int check(int x[], int a) {
for (int i = 0; i < 3; i++)
if (x[i] <= a) return false;
return true;
}
int main() {
scanf("%d%d", &n, &m);
for (int i = 0; i < 3; i++) x[i] = m;
sort(x, x + 3);
int ret = 0;
while (!check(x, n)) {
sort(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.*;
import java.util.*;
public class C
{
public static void main(String[] args)
{
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int a = sc.nextInt(), b = sc.nextInt();
ArrayList<Integer> inp = new Arr... | 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 n, m;
cin >> n >> m;
int a[3];
a[0] = a[1] = a[2] = m;
int count = 0;
sort(a, a + 3);
while (a[0] != n) {
int si = a[1] + a[2];
a[0] = (si - 1 > n) ? n : (si - 1);
count++;
sort(a, a + 3);
}
cout << count << 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 | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class C
{
String line;
StringTokenizer inputParser;
BufferedReader is;
FileInputStream fstream;
DataInputStream in;
String FInput="";
void openInput(String file)
{
if(file==null)is = new BufferedReader(new InputStreamReader(System... | 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 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//package javaapplication1;
import java.util.Scanner;
/**
*
* @author TaMeEm
*/
public class JavaApplication1 {
/**
* @p... | 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.*;
import java.lang.*;
public class test5 {
public static void main(String args[]){
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int initlength = sc.nextInt();
int finlength = sc.nextInt();
int holder = 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 | x,y=map(int,input().split())
t=0
ba=y
bb=y
bc=y
while True:
if (ba >= x and bb >= x and bc >= x):
print(t)
break
t+=1
if t%3==1:
ba = bb + bc - 1
if t % 3 == 2:
bb = ba + bc - 1
if t%3==0:
bc = ba + bb - 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;
template <class A>
ostream& operator<<(ostream& out, const vector<A>& v) {
for (long long i = 0; i < v.size(); i++) {
if (i) out << " ";
out << v[i];
}
return out << '\n';
}
long long mod = 1000000007;
inline long long add(long long a, long long b) {
a += b;... | 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 {
private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int x = scanner.nextInt(), y = scanner.nextInt();
long output = 0;
int[] lol = {y, y, y};
while (lol[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 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int x, y;
cin >> x >> y;
int arr[3] = {y, y, y};
int counter = 0;
while (arr[0] != x) {
int temp1 = arr[1];
int temp2 = arr[2];
arr[0] = temp1;
arr[1] = temp2;
arr[2] = min(x, arr[0] + arr[1] - 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 | x, y = map(int,input().split())
ar = [y,y,y]
ans = 0
while min(ar) < x:
ar.sort()
ar[0] = ar[1] + ar[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;
int main() {
int x, y, a, b, c, num = 0;
scanf("%d%d", &x, &y);
a = b = c = y;
while (a < x || b < x || c < x) {
if (a <= b && a <= c)
a = b + c - 1;
else if (b <= a && b <= c)
b = a + c - 1;
else
c = a + b - 1;
num++;
}
printf(... | 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>
long long int power(long long int x, long long int b) {
long long int p = 1;
while (b > 0) {
if (b & 1) {
p = p * x;
p %= 9000000000000000000;
}
b >>= 1;
x *= x;
x %= 9000000000000000000;
}
return p % 9000000000000000000;
}
using namespace std;
struct lex... | 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.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class C {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.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.*;
public class CodeForces {
private final BufferedReader reader;
private final PrintWriter writer;
private StringTokenizer tokenizer;
private void solve() {
int x = nextInt();
int y = nextInt();
int[] xs = new int[]{x, x, x};
int[] ys... | 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 {
static int a,b,c;
public static void main(String[] args) {
FastScanner3 sc = new FastScanner3(System.in);
a = sc.nextInt();
b = c = a;
int goal = sc.nextInt();
int ctr = 0;
int[] arr = new int[]{goal, goal, goal};
goal = a;
... | 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 MAXN = 101;
const int MOD = 1000000007;
const double PI = 4 * atan(1);
int sides[3];
int x, y;
bool desired() {
if (sides[0] == sides[1] && sides[1] == sides[2] && sides[2] == x) {
return true;
}
return false;
}
int main() {
ios::sync_with_stdio(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.io.*;
import java.util.LinkedList;
public class test3 {
public static void main(String [] args){
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
int b=sc.nextInt();
int arr[]=new int[3];
arr[0]=b;
arr[1]=b;
arr[2]=b;
int sum=0;
int count=0;
int a2=0;
while(count<3){
if(a2%3==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 | x, y = map(int, input().split())
if (x > y):
x, y = y, x
a = x
b = x
c = x
ans = 0
while not (a == b == c == y):
if (a <= b and a <= c):
a = min(b + c - 1, y)
elif (b <= a and b <= c):
b = min(a + c - 1, y)
elif (c <= a and c <= b):
c = min(a + b - 1, y)
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;
int main() {
long n, m;
while (cin >> n >> m) {
long cnt = 0, ar[10] = {0}, k = 0;
ar[0] = m;
ar[1] = m;
ar[2] = m;
while (1) {
sort(ar, ar + 3);
if (ar[0] >= n) break;
ar[0] = min(n, ar[1] + ar[2] - 1);
cnt++;
}
cout ... | 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 math
def inp():
return int(raw_input())
def linp():
return map(int, raw_input().split())
X, Y = linp()
x=max(X, Y)
y=min(X, Y)
li=[y, y, y]
ans=0
while li!=[x, x, x]:
a, b, c=li[0], li[1], li[2]
#print li
if c!=x:
temp=b
b=c
c=min(x, temp+c-1)
ans+=1
li... | 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 x, y;
cin >> x >> y;
int arr[3] = {y, y, y};
int cnt = 0;
while (arr[0] != x || arr[1] != x || arr[2] != x) {
++cnt;
arr[0] = min(x, arr[1] + arr[2] - 1);
sort(arr, arr + 3);
}
cout << 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.io.*;
import java.util.*;
public class MemoryAndDeEvolution {
static long countTime = 0;
public static void evlove(long[] arr, long s2, long s1){
if(s2 == s1)
return;
while(arr[0]!=s1 || arr[1]!=s1 || arr[2]!=s1){
countTime++;
arr[0] = Math.min(s1,arr[1]+arr[2]-1);
sort(arr);
}... | 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;
import java.util.StringTokenizer;
public class MemoryAndDeevolution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
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 memoryDevolution
{
static boolean checkTriangle(int a, int b, int c)
{
if (a+b > c && c+a > b && b+c > a)
return true;
else
return false;
}
static int x;
static int y;
static int [] sides;
public static void main(String args[])throws IOException
... | 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.math.*;
import java.util.*;
public class Main {
private static char [] pair = new char[128];
private static char [] C,S;
private static int [] cnt;
private static void compress(){
int m = 0;
char lst = 0;
for (int i = 0;i < S.length;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 | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main {
FastScanner in;
PrintWriter out;
static final String FILE = "";
void solve() {
int[] ms = new int[3];
int x = in.nextInt(), y = in.nextInt();
for (int i = 0; i < 3; i++)
ms[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;
const long long N = 1e6 + 100, INF = 1e9 + 7, P = 1e9 + 7;
int n, m, cnt, t[5];
int main() {
cin >> n >> m;
t[1] = t[2] = t[3] = m;
while (t[1] != n) {
cnt++;
t[1] = min(t[2] + t[3] - 1, n);
sort(t + 1, t + 4);
}
cout << 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 | s, e = map(int,input().split())
a = [e] * 3
ans = 0
sum = 0
while sum != 2:
temp = a[1] + a[2]
if temp - 1 >= s:
a[0] = s
sum += 1
else:
a[0] = temp - 1
a.sort()
ans += 1
print(ans + 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;
int main() {
int a, b;
cin >> a >> b;
int cnt = 0;
if (a > b) swap(a, b);
int first = a, second = a;
while (first + second <= b) {
int temp = first + second - 1;
second = first;
first = temp;
cnt++;
}
cnt += 3;
cout << cnt << "\n";
}
| 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;
void solve();
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
}
long long ar[3];
void solve() {
long long x, y, ans = 0;
cin >> x >> y;
ar[0] = ar[1] = ar[2] = y;
while (ar[0] < x || ar[1] < x || ar[2] < x) {
sort(ar, ar + 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 | import java.util.*;
import java.io.*;
public class Memory_and_DeEvolution {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(f.readLine());
int x = Integer.parseInt(st.nextToken());
... | 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 = [int(i) for i in input().split()]
if x > y:
t = x
x = y
y = t
a = [x, x, x]
ans = 0
while a[0] != y or a[1] != y or a[2] != y:
a[0] = min(a[1] + a[2] - 1, y)
a.sort()
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 | //package leto;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
public class letnee4 {
public static void main(String[] args) throws FileNotFoun... | 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 arr[3];
int f, t;
int main() {
while (cin >> f >> t) {
arr[0] = arr[1] = arr[2] = t;
int res = 0;
while (arr[0] < f || arr[1] < f || arr[2] < f) {
sort(arr, arr + 3);
arr[0] = min(arr[1] + arr[2] - 1, f);
res++;
}
cout << res << '... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.