Đăng nhập để hỏi chi tiết
Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
`#Bơ`
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
using namespace std;
int main(){
fast;
int s1, v1, s2, v2;
cin >> s1 >> v1 >> s2 >> v2;
if(v1 == v2){
if(s1 == s2)
cout << 0;
else
cout << -1;
}
else{
double t = 1.0 *(s2 - s1) / (v1 - v2);
if(t < 0)
cout<<-1;
else
cout<<(ll)t;
}
return 0;
}
`\color{#1AD5F7}{⋆⟡D}\color{#1AD5F7}{r}\color{#4DA6E6}{a}\color{#668EDD}{g}\color{#8077D5}{o}\color{#995FCD}{n}\color{#EA2F90}{⟡⋆}`
Hãy giúp mọi người biết câu trả lời này thế nào?
#include<bits/stdc++.h>
using namespace std;
//------------------
#define ll long long
#define int long long
#define dcchuyentoan ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define el cout << endl
//------------------
ll a,b,c,d;
//------------------
signed main()
{
dcchuyentoan;
cin >> a >> b >> c >> d;
if(c == d)
{
if(a == c)
{
cout << 0;
}
else
{
cout << -1;
}
}
else
{
ll x = c - a;
ll y = b - d;
if(y == 0 || x % y != 0)
{
cout << -1;
}
else
{
if (x / y < 0)
{
cout << -1;
}
else
{
cout << (x / y);
}
}
}
}
$\dcchuyentoan$
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin
12
397
3
khó nha bro ko nha câu này đề tỉnh á:)
795
299
342
câu này lúc tôi ôn huyện cô cho lm rồi dg còn đề này