Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 791A.cpp #1538

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions 29. Codeforces Problems/50A.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Link to problem: https://codeforces.com/problemset/problem/50/A

#include<iostream>
#include<algorithm>
#include <iostream>

using namespace std;

int main()
{
int a, b, n, m;
cin>>a>>b;
n = ( int(min(a,b)/2) * (max(a,b)) );
m = (a*b) - (2*n);
m = m/2;
cout<<n + m<<endl;
int M, N;
cin >> M >> N;
cout << M * N / 2 << endl;
return 0;
}
29 changes: 19 additions & 10 deletions 29. Codeforces Problems/791A.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
# https://codeforces.com/problemset/problem/791/A
# 791A - Bear and Big Brother

sizes = [int(size) for size in input().split()]
i = 0

while sizes[0] <= sizes[1]:
sizes[0] *= 3
sizes[1] *= 2
i += 1

print(i)
#this code is written in c++ langaunge
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c=0;
cin>>a>>b;
if(a>b)
c=0;
else
while(a<=b)
{
a=a*3;
b=b*2;
c++;
}
cout<<c<<endl;
return 0;
}