buggy_code
stringlengths 11
625k
| fixed_code
stringlengths 17
625k
| bug_type
stringlengths 2
4.45k
| language
int64 0
8
| token_count
int64 5
200k
|
|---|---|---|---|---|
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
vector<double> a(2), b(2), c(2), d(2);
double tmp;
cin >> a[0] >> a[1] >> b[0] >> b[1] >> c[0] >> c[1] >> d[0] >> d[1];
double x1 = b[0] - a[0], y1 = b[1] - a[1];
double x2 = d[0] - c[0], y2 = d[1] - c[1];
if (x1 * y2 - x2 * y1 > 0)
cout << "NO" << endl;
else
cout << "YES" << endl;
}
return 0;
}
|
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
vector<double> a(2), b(2), c(2), d(2);
double tmp;
cin >> a[0] >> a[1] >> b[0] >> b[1] >> c[0] >> c[1] >> d[0] >> d[1];
double x1 = b[0] - a[0], y1 = b[1] - a[1];
double x2 = d[0] - c[0], y2 = d[1] - c[1];
if (x1 * y2 - x2 * y1 == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
|
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
| 1
| 188
|
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#if __GNUC__
#include <tr1/unordered_map>
#include <tr1/unordered_set>
using namespace tr1;
#else
#include <unordered_map>
#include <unordered_set>
#endif
#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int popcount(T n) {
return n ? 1 + popcount(n & (n - 1)) : 0;
}
#endif
#ifdef __GNUC__
template <class T> int popcount(T n);
template <> int popcount(unsigned int n) { return __builtin_popcount(n); }
template <> int popcount(int n) { return __builtin_popcount(n); }
template <> int popcount(unsigned long long n) {
return __builtin_popcountll(n);
}
template <> int popcount(long long n) { return __builtin_popcountll(n); }
#endif
#define rep (i, n) for (int i = 0; i < (int)n; ++i)
#define foreach(it, c) \
for (__typeof__((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define rforeach(it, c) \
for (__typeof__((c).rbegin()) it = (c).rbegin(); it != (c).rend(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CL(arr, val) memset(arr, val, sizeof(arr))
#define MEMCPY(dest, src) memcpy(dest, src, sizeof(src))
template <class T> void max_swap(T &a, const T &b) { a = max(a, b); }
template <class T> void min_swap(T &a, const T &b) { a = min(a, b); }
typedef long long ll;
typedef pair<int, int> pint;
template <class T> string to_s(const T &a) {
ostringstream os;
os << a;
return os.str();
}
const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
bool valid_pos(int x, int y, int w, int h) {
return 0 <= x && x < w && 0 <= y && y < h;
}
template <class T>
void print(T a, int n, int br = 1, const string &deli = ", ") {
cout << "{ ";
for (int i = 0; i < n; ++i) {
cout << a[i];
if (i + 1 != n)
cout << deli;
}
cout << " }";
while (br--)
cout << endl;
}
template <class T>
void print(const vector<T> &v, int br = 1, const string &deli = ", ") {
print(v, v.size(), br, deli);
}
template <class T> void print2d(T a, int w, int h, int width = -1, int br = 1) {
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; ++j) {
if (width != -1)
cout.width(width);
cout << a[i][j] << ' ';
}
cout << endl;
}
while (br--)
cout << endl;
}
template <class T> void input(int n, T &a) {
for (int i = 0; i < n; ++i)
cin >> a[i];
}
template <class T, class U> void input(int n, T &a, U &b) {
for (int i = 0; i < n; ++i)
cin >> a[i] >> b[i];
}
template <class T> vector<T> input(int n) {
vector<T> res(n);
for (int i = 0; i < n; ++i)
cin >> res[i];
return res;
}
const double EPS_FOR_LIB = 1e-9;
typedef double geo_type;
typedef complex<geo_type> Point;
typedef vector<Point> Poly;
namespace std {
bool operator<(const Point &a, const Point &b) {
return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag();
}
std::istream &operator>>(std::istream &is, Point &p) {
geo_type a, b;
is >> a >> b;
p = Point(a, b);
return is;
}
std::ostream &operator<<(std::ostream &os, Point &p) {
return os << "(" << p.real() << ", " << p.imag() << ")";
}
}; // namespace std
struct Line {
Point a, b;
Line(Point a, Point b) : a(a), b(b) {}
Line() {}
};
geo_type dot(const Point &a, const Point &b) {
return a.real() * b.real() + a.imag() * b.imag();
}
geo_type cross(const Point &a, const Point &b) {
return a.real() * b.imag() - a.imag() * b.real();
}
bool is_parallel(const Line &line1, const Line &line2) {
return cross(line1.b - line1.a, line2.b - line2.a) < EPS_FOR_LIB;
}
int main() {
int n;
cin >> n;
while (n--) {
Point p[4];
input(4, p);
cout << (is_parallel(Line(p[0], p[1]), Line(p[2], p[3])) ? "YES" : "NO")
<< endl;
}
}
|
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#if __GNUC__
#include <tr1/unordered_map>
#include <tr1/unordered_set>
using namespace tr1;
#else
#include <unordered_map>
#include <unordered_set>
#endif
#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int popcount(T n) {
return n ? 1 + popcount(n & (n - 1)) : 0;
}
#endif
#ifdef __GNUC__
template <class T> int popcount(T n);
template <> int popcount(unsigned int n) { return __builtin_popcount(n); }
template <> int popcount(int n) { return __builtin_popcount(n); }
template <> int popcount(unsigned long long n) {
return __builtin_popcountll(n);
}
template <> int popcount(long long n) { return __builtin_popcountll(n); }
#endif
#define rep (i, n) for (int i = 0; i < (int)n; ++i)
#define foreach(it, c) \
for (__typeof__((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define rforeach(it, c) \
for (__typeof__((c).rbegin()) it = (c).rbegin(); it != (c).rend(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CL(arr, val) memset(arr, val, sizeof(arr))
#define MEMCPY(dest, src) memcpy(dest, src, sizeof(src))
template <class T> void max_swap(T &a, const T &b) { a = max(a, b); }
template <class T> void min_swap(T &a, const T &b) { a = min(a, b); }
typedef long long ll;
typedef pair<int, int> pint;
template <class T> string to_s(const T &a) {
ostringstream os;
os << a;
return os.str();
}
const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
bool valid_pos(int x, int y, int w, int h) {
return 0 <= x && x < w && 0 <= y && y < h;
}
template <class T>
void print(T a, int n, int br = 1, const string &deli = ", ") {
cout << "{ ";
for (int i = 0; i < n; ++i) {
cout << a[i];
if (i + 1 != n)
cout << deli;
}
cout << " }";
while (br--)
cout << endl;
}
template <class T>
void print(const vector<T> &v, int br = 1, const string &deli = ", ") {
print(v, v.size(), br, deli);
}
template <class T> void print2d(T a, int w, int h, int width = -1, int br = 1) {
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; ++j) {
if (width != -1)
cout.width(width);
cout << a[i][j] << ' ';
}
cout << endl;
}
while (br--)
cout << endl;
}
template <class T> void input(int n, T &a) {
for (int i = 0; i < n; ++i)
cin >> a[i];
}
template <class T, class U> void input(int n, T &a, U &b) {
for (int i = 0; i < n; ++i)
cin >> a[i] >> b[i];
}
template <class T> vector<T> input(int n) {
vector<T> res(n);
for (int i = 0; i < n; ++i)
cin >> res[i];
return res;
}
const double EPS_FOR_LIB = 1e-9;
typedef double geo_type;
typedef complex<geo_type> Point;
typedef vector<Point> Poly;
namespace std {
bool operator<(const Point &a, const Point &b) {
return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag();
}
std::istream &operator>>(std::istream &is, Point &p) {
geo_type a, b;
is >> a >> b;
p = Point(a, b);
return is;
}
std::ostream &operator<<(std::ostream &os, Point &p) {
return os << "(" << p.real() << ", " << p.imag() << ")";
}
}; // namespace std
struct Line {
Point a, b;
Line(Point a, Point b) : a(a), b(b) {}
Line() {}
};
geo_type dot(const Point &a, const Point &b) {
return a.real() * b.real() + a.imag() * b.imag();
}
geo_type cross(const Point &a, const Point &b) {
return a.real() * b.imag() - a.imag() * b.real();
}
bool is_parallel(const Line &line1, const Line &line2) {
return abs(cross(line1.b - line1.a, line2.b - line2.a)) < EPS_FOR_LIB;
}
int main() {
int n;
cin >> n;
while (n--) {
Point p[4];
input(4, p);
cout << (is_parallel(Line(p[0], p[1]), Line(p[2], p[3])) ? "YES" : "NO")
<< endl;
}
}
|
[["+", 8, 9, 0, 37, 0, 16, 31, 2, 63, 22], ["+", 0, 37, 0, 16, 31, 2, 3, 4, 0, 24], ["+", 31, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
| 1
| 1,192
|
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <vector>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a) (a).begin(), (a).end()
#define REP(i, n) for (int i = 0; i < (n); ++i)
const double EPS = 1e-10;
const double PI = acos(-1.0);
#define dump(x) \
cerr << " (L" << __LINE__ << ") " << #x << " = " << (x) << endl;
#define dumpv(x) \
cerr << " (L" << __LINE__ << ") " << #x << " = "; \
REP(q, (x).size()) cerr << (x)[q] << " "; \
cerr << endl;
template <typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &d) {
return s << "(" << d.first << "," << d.second << ")";
}
double cross(complex<double> &a, complex<double> &b) {
return a.real() * b.imag() - a.imag() * b.real();
}
int main() {
int T;
cin >> T;
REP(t, T) {
vector<double> in(8);
REP(i, 8) cin >> in[i];
complex<double> a(in[2] - in[0], in[3] - in[1]);
complex<double> b(in[6] - in[4], in[7] - in[5]);
double exter_product = cross(a, b);
if (exter_product < EPS) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
}
|
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <vector>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a) (a).begin(), (a).end()
#define REP(i, n) for (int i = 0; i < (n); ++i)
const double EPS = 1e-10;
const double PI = acos(-1.0);
#define dump(x) \
cerr << " (L" << __LINE__ << ") " << #x << " = " << (x) << endl;
#define dumpv(x) \
cerr << " (L" << __LINE__ << ") " << #x << " = "; \
REP(q, (x).size()) cerr << (x)[q] << " "; \
cerr << endl;
template <typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &d) {
return s << "(" << d.first << "," << d.second << ")";
}
double cross(complex<double> &a, complex<double> &b) {
return a.real() * b.imag() - a.imag() * b.real();
}
int main() {
int T;
cin >> T;
REP(t, T) {
vector<double> in(8);
REP(i, 8) cin >> in[i];
complex<double> a(in[2] - in[0], in[3] - in[1]);
complex<double> b(in[6] - in[4], in[7] - in[5]);
double exter_product = cross(a, b);
if (abs(exter_product) < EPS) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
}
|
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]]
| 1
| 335
|
#include <cstdint>
#include <iostream>
int main() {
std::uint32_t n;
std::cin >> n;
for (std::uint32_t i = 0; i < n; ++i) {
double x1, y1, x2, y2, x3, y3, x4, y4;
std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
if ((x1 - x2) * (y3 - y4) - (x3 - x4) * (y1 - y2) == 0.0) {
std::cout << "NO" << std::endl;
} else {
std::cout << "YES" << std::endl;
}
}
return 0;
}
|
#include <cstdint>
#include <iostream>
int main() {
std::uint32_t n;
std::cin >> n;
for (std::uint32_t i = 0; i < n; ++i) {
double x1, y1, x2, y2, x3, y3, x4, y4;
std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
if ((x1 - x2) * (y3 - y4) - (x3 - x4) * (y1 - y2) != 0.0) {
std::cout << "NO" << std::endl;
} else {
std::cout << "YES" << std::endl;
}
}
return 0;
}
|
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79]]
| 1
| 136
|
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
double abdx, abdy, cddx, cddy;
double x[4];
double y[4];
for (int j = 0; j < 4; ++j) {
cin >> x[j] >> y[j];
}
abdx = x[0] - x[1];
cddx = x[2] - x[3];
abdy = y[0] - y[1];
cddy = y[2] - y[3];
if ((abdy / abdx) == (cddy / cddx))
cout << "yes" << endl;
else
cout << "NO" << endl;
}
}
|
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
double abdx, abdy, cddx, cddy;
double x[4];
double y[4];
for (int j = 0; j < 4; ++j) {
cin >> x[j] >> y[j];
}
abdx = x[0] - x[1];
cddx = x[2] - x[3];
abdy = y[0] - y[1];
cddy = y[2] - y[3];
if (abdy / abdx == cddy / cddx)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
|
[["-", 0, 57, 15, 339, 51, 16, 31, 23, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 31, 23, 0, 25], ["-", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25], ["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
| 1
| 163
|
#include <cmath>
#include <iostream>
using namespace std;
#define EPS 1e-10
int main() {
int n;
double x1, x2, x3, x4, y1, y2, y3, y4;
cin >> n;
while (n--) {
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
if (abs((x4 - x3) * (y2 - y1) - (x2 - x1) * (y4 - y2)) < EPS)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
|
#include <cmath>
#include <iostream>
using namespace std;
#define EPS 1e-10
int main() {
int n;
double x1, x2, x3, x4, y1, y2, y3, y4;
cin >> n;
while (n--) {
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
if (abs((x4 - x3) * (y2 - y1) - (x2 - x1) * (y4 - y3)) < EPS)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
|
[["-", 0, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 12, 22]]
| 1
| 114
|
#include <iostream>
#include <map>
using namespace std;
int main(void) {
int n, x[2], y[2];
pair<int, int> v[2];
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < 2; j++) {
cin >> x[0] >> y[0] >> x[1] >> y[1];
v[j] = make_pair(x[0] - x[1], y[0] - y[1]);
}
cout << (v[0].first * v[1].second - v[0].second * v[1].first ? "YES" : "NO")
<< endl;
}
return 0;
}
|
#include <iostream>
#include <map>
using namespace std;
int main(void) {
int n;
float x[2], y[2];
pair<float, float> v[2];
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < 2; j++) {
cin >> x[0] >> y[0] >> x[1] >> y[1];
v[j] = make_pair(x[0] - x[1], y[0] - y[1]);
}
cout << (v[0].first * v[1].second - v[0].second * v[1].first ? "NO" : "YES")
<< endl;
}
return 0;
}
|
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
| 1
| 170
|
#include <cmath>
#include <complex>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a) * b).imag(); }
const double eps = 1e-12;
double x[4], y[4];
int N;
int main() {
cin >> N;
for (int i = 0; i < N; ++i) {
for (int i = 0; i < 4; ++i) {
cin >> x[i] >> y[i];
}
xy_t a[2] = {xy_t(x[0], y[0]) - xy_t(x[1], y[1]),
xy_t(x[2], y[2]) - xy_t(x[3], y[3])};
bool p = abs(cross_product(a[0], a[1]) / 2) < eps;
cout << (p ? "Yes" : "No") << endl;
}
}
|
#include <cmath>
#include <complex>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a) * b).imag(); }
const double eps = 1e-11;
double x[4], y[4];
int N;
int main() {
cin >> N;
for (int i = 0; i < N; ++i) {
for (int i = 0; i < 4; ++i) {
cin >> x[i] >> y[i];
}
xy_t a[2] = {xy_t(x[0], y[0]) - xy_t(x[1], y[1]),
xy_t(x[2], y[2]) - xy_t(x[3], y[3])};
bool p = abs(cross_product(a[0], a[1])) / 2 < eps;
cout << (p ? "YES" : "NO") << endl;
}
}
|
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 31, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["-", 49, 50, 51, 16, 31, 2, 3, 4, 0, 25], ["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
| 1
| 215
|
gets
$<.map{|l|a,b,c,d,e,f,g,h=l.split.map &:to_f
puts ((a-c)*(f-h)-(b-d)*(e-g)).abs>1e-15?:YES: :NO}
|
gets
$<.map{|l|a,b,c,d,e,f,g,h=l.split.map &:to_f
puts ((a-c)*(f-h)-(b-d)*(e-g)).abs<1e-10?:YES: :NO}
|
[["-", 0, 652, 3, 4, 0, 754, 15, 738, 17, 47], ["-", 0, 652, 3, 4, 0, 754, 15, 738, 12, 531], ["+", 0, 652, 3, 4, 0, 754, 15, 738, 17, 18], ["+", 0, 652, 3, 4, 0, 754, 15, 738, 12, 531]]
| 4
| 66
|
n=gets.to_i;n.times{a,b,c,d,e,f,g,h=gets.split.map &:to_f;puts ((c-a)*(h-f)-(d-b)*(g-e)).abs<1e10 ?"YES":"NO"}
|
n=gets.to_i;n.times{a,b,c,d,e,f,g,h=gets.split.map &:to_f;puts ((c-a)*(h-f)-(d-b)*(g-e)).abs<1e-10 ?"YES":"NO"}
|
[["-", 0, 652, 3, 4, 0, 754, 15, 738, 12, 531], ["+", 0, 652, 3, 4, 0, 754, 15, 738, 12, 531]]
| 4
| 73
|
def slope(x1, y1, x2, y2)
return (y2 - y1).round/(x2 - x1).round
end
result = []
gets.to_i.times{
xa, ya, xb, yb, xc, yc, xd, yd = gets.split.map(&:to_f)
ab = slope(xa, ya, xb, yb)
cd = slope(xc, yc, xd, yd)
result << ((ab == cd) ? "YES" : "NO")
}
result.each{|r|
puts r
}
|
def slope(x1, y1, x2, y2)
return (y2 - y1).round(6)/(x2 - x1).round(6)
end
result = []
gets.to_i.times{
xa, ya, xb, yb, xc, yc, xd, yd = gets.split.map(&:to_f)
ab = slope(xa, ya, xb, yb)
cd = slope(xc, yc, xd, yd)
result << ((ab == cd) ? "YES" : "NO")
}
result.each{|r|
puts r
}
|
[["+", 0, 4, 0, 738, 31, 652, 3, 4, 0, 24], ["+", 0, 4, 0, 738, 31, 652, 3, 4, 0, 612], ["+", 0, 4, 0, 738, 31, 652, 3, 4, 0, 25], ["+", 0, 4, 0, 738, 12, 652, 3, 4, 0, 24], ["+", 0, 4, 0, 738, 12, 652, 3, 4, 0, 612], ["+", 0, 4, 0, 738, 12, 652, 3, 4, 0, 25]]
| 4
| 115
|
num = gets.chomp.to_i
num.times do |n|
x1, y1, x2, y2, x3, y3, x4, y4 = gets.chomp.split(" ").map(&:to_f)
if y2 == y1 || y4 == y3
if y2 == y1 && y4 == y3
puts "YES"
else
puts "NO"
end
next
elsif (x2 - x1)/(y2 - y1) - (x4 - x3)/(y4 - y3) < 1e-10
puts "YES"
else
puts "NO"
end
end
|
num = gets.chomp.to_i
num.times do |n|
x1, y1, x2, y2, x3, y3, x4, y4 = gets.chomp.split(" ").map(&:to_f)
if y2 == y1 || y4 == y3
if y2 == y1 && y4 == y3
puts "YES"
else
puts "NO"
end
next
elsif ((x2 - x1)/(y2 - y1) - (x4 - x3)/(y4 - y3)).abs < 1e-10
puts "YES"
else
puts "NO"
end
end
|
[["+", 486, 739, 0, 738, 31, 738, 31, 739, 0, 24], ["+", 486, 739, 0, 738, 12, 738, 12, 739, 0, 25], ["+", 0, 121, 75, 759, 15, 738, 31, 652, 17, 131], ["+", 0, 121, 75, 759, 15, 738, 31, 652, 735, 22]]
| 4
| 110
|
N = input()
for n in range(N):
data = map(float,input().split( ))
slopes = []
for i in range(2):
_x1 = data.pop(0)
_y1 = data.pop(0)
_x2 = data.pop(0)
_y2 = data.pop(0)
if _x1 != _x2:
slopes.append((_y1 - _y2)/(_x1 - _x2))
if len(slopes) == 0:
print("YES")
elif len(slopes) == 1:
print("NO")
elif abs(slopes[0] - slopes[1]) < 1e-10:
print("YES")
else:
print("NO")
|
N = eval(input())
for n in range(N):
data = list(map(float,input().split( )))
slopes = []
for i in range(2):
_x1 = data.pop(0)
_y1 = data.pop(0)
_x2 = data.pop(0)
_y2 = data.pop(0)
if _x1 != _x2:
slopes.append((_y1 - _y2)/(_x1 - _x2))
if len(slopes) == 0:
print("YES")
elif len(slopes) == 1:
print("NO")
elif abs(slopes[0] - slopes[1]) < 1e-10:
print("YES")
else:
print("NO")
|
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
| 5
| 150
|
N = int(input())
for i in range(0, N) :
x1,y1,x2,y2,x3,y3,x4,y4 = list(map(float, input().split()))
s = x2 - x1
t = y2 - y1
u = x4 - x3
v = y4 - y3;
if (s * v - t * u < 1.000000001) :
print("YES")
else :
print("NO")
|
N = int(input())
for i in range(0, N) :
x1,y1,x2,y2,x3,y3,x4,y4 = list(map(float, input().split()))
s = x2 - x1
t = y2 - y1
u = x4 - x3
v = y4 - y3;
if (abs(s * v - t * u) < 1e-10) :
print("YES")
else :
print("NO")
|
[["+", 0, 57, 15, 23, 0, 666, 0, 652, 63, 22], ["+", 15, 23, 0, 666, 0, 652, 3, 4, 0, 24], ["+", 15, 23, 0, 666, 0, 652, 3, 4, 0, 25], ["-", 8, 196, 0, 57, 15, 23, 0, 666, 0, 531], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 0, 531]]
| 5
| 97
|
n = int(input())
for _ in range(n):
x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
dx12, dx34, dy12, dy34 = x1 - x2, x3 - x4, y1 - y2, y3 - y4
print('YES' if dx12 * dy34 - dy12 * dx34 < 1e-10 else 'NO')
|
n = int(input())
for _ in range(n):
x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
dx12, dx34, dy12, dy34 = x1 - x2, x3 - x4, y1 - y2, y3 - y4
print('YES' if abs(dx12 * dy34 - dy12 * dx34) < 1e-10 else 'NO')
|
[["+", 3, 4, 0, 41, 0, 666, 0, 652, 63, 22], ["+", 0, 41, 0, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 41, 0, 666, 0, 652, 3, 4, 0, 25]]
| 5
| 87
|
def cross(x, y):
return (x.conjugate() * y).imag
#x, y: direction vector
def is_parallel(x, y):
if cross(x, y) < 1e-6:
return True
return False
n = int(input())
for i in range(n):
x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
a = complex(x2, y2) - complex(x1, y1)
b = complex(x4, y4) - complex(x3, y3)
if is_parallel(a, b):
print('YES')
else:
print('NO')
|
def cross(x, y):
return (x.conjugate() * y).imag
def is_parallel(x, y):
if abs(cross(x, y)) < 1e-10:
return True
return False
n = int(input())
for i in range(n):
x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
a = complex(x2, y2) - complex(x1, y1)
b = complex(x4, y4) - complex(x3, y3)
if is_parallel(a, b):
print('YES')
else:
print('NO')
|
[["+", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 531], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 531]]
| 5
| 139
|
for i in range(int(input())):
s = list(map(float,input().split()))
if s[1] - s[3] == 0 or s[5] - s[7] == 0:
if s[1] - s[3] == s[5] - s[7] == 0:
print('YES')
else:
print('NO')
elif (s[0] - s[2]) / (s[1] - s[3]) - (s[4] - s[6]) / (s[5] - s[7]) < 1e-10:
print('YES')
else:
print('NO')
|
for i in range(int(input())):
s = list(map(float,input().split()))
if s[1] - s[3] == 0 or s[5] - s[7] == 0:
if s[1] - s[3] == s[5] - s[7] == 0:
print('YES')
else:
print('NO')
elif abs((s[0] - s[2]) / (s[1] - s[3]) - (s[4] - s[6]) / (s[5] - s[7])) < 1e-10:
print('YES')
else:
print('NO')
|
[["+", 0, 57, 75, 665, 15, 666, 0, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 25]]
| 5
| 157
|
for _ in range(int(input())):
ax, ay, bx, by, cx, cy, dx, dy = map(float, input().split())
print(['NO','YES'][(ay-by)*(dx-cx)-(ax-bx)*(dy-cy)<1e-10])
|
for _ in range(int(input())):
ax, ay, bx, by, cx, cy, dx, dy = map(float, input().split())
print(['NO','YES'][abs((ay-by)*(dx-cx)-(ax-bx)*(dy-cy))<1e-10])
|
[["+", 3, 4, 0, 206, 206, 666, 0, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 25]]
| 5
| 80
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int v;
while (cin >> v) {
int N = 0;
for (;; ++N) {
int y = 5 * N - 5;
if (v * v * 10 <= 196 * y)
break;
}
cout << N << endl;
}
return 0;
}
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
double v;
while (cin >> v) {
int N = 0;
for (;; ++N) {
int y = 5 * N - 5;
if (v * v * 10 <= 196 * y)
break;
}
cout << N << endl;
}
return 0;
}
|
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
| 1
| 73
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
double in;
int ans;
while (scanf("%lf", &in) != EOF) {
ans = (int)(in * in / 98);
printf("%d\n", ans + 1);
}
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
double in;
int ans;
while (scanf("%lf", &in) != EOF) {
ans = ceil(in * in / 98);
printf("%d\n", ans + 1);
}
return 0;
}
|
[["-", 8, 9, 0, 1, 0, 11, 12, 74, 0, 24], ["-", 0, 1, 0, 11, 12, 74, 39, 77, 39, 40], ["-", 8, 9, 0, 1, 0, 11, 12, 74, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
| 1
| 78
|
#include <algorithm>
#include <climits>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
int x;
while (cin >> x) {
double h = 4.9 * x * x / 9.8 / 9.8;
int y = 0;
while (5 * y - 5 < h)
y++;
cout << y << endl;
}
return 0;
}
|
#include <algorithm>
#include <climits>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
double x;
while (cin >> x) {
double h = 4.9 * x * x / 9.8 / 9.8;
int y = 0;
while (5 * y - 5 < h)
y++;
cout << y << endl;
}
return 0;
}
|
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
| 1
| 77
|
#include <algorithm>
#include <climits>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
int x;
while (cin >> x) {
double h = (5 + 4.9 * x / 9.8 * x / 9.8) / 5;
int y = 0;
while (y < h)
y++;
cout << y << endl;
}
return 0;
}
|
#include <algorithm>
#include <climits>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
double x;
while (cin >> x) {
double h = (5 + 4.9 * x / 9.8 * x / 9.8) / 5;
int y = 0;
while (y < h)
y++;
cout << y << endl;
}
return 0;
}
|
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
| 1
| 79
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
double v;
while (cin >> v) {
double y = v * v / 19.8;
double N = (y + 5.0) / 5.0;
cout << ceil(N) << endl;
}
return 0;
}
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
double v;
while (cin >> v) {
double y = v * v / 19.6;
double N = (y + 5.0) / 5.0;
cout << ceil(N) << endl;
}
return 0;
}
|
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
| 1
| 57
|
#include <stdio.h>
int main() {
double v = 0.0, t = 0.0, y = 0.0;
while (scanf("%lf", &v) != EOF) {
t = v / 9.8;
y = 4.9 * t * t;
printf("%.0f\n", (y / 5 + 1));
}
return 0;
}
|
#include <stdio.h>
int main() {
double v = 0.0, t = 0.0, y = 0.0;
while (scanf("%lf", &v) != EOF) {
t = v / 9.8;
y = 4.9 * t * t;
printf("%.0f\n", (y / 5 + 1) + 0.5);
}
return 0;
}
|
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
| 1
| 70
|
#include <iostream>
#define rep(i, a, n) for (int i = a; i < n; i++)
using namespace std;
int main() {
double v;
while (cin >> v) {
double t = v / 9.8;
double y = t * t * 4.9;
int ans = 0;
rep(i, 0, 60) {
int h = 5 * (i - 1);
if (h > y) {
ans = i;
break;
}
}
cout << ans << endl;
}
}
|
#include <iostream>
#define rep(i, a, n) for (int i = a; i < n; i++)
using namespace std;
int main() {
double v;
while (cin >> v) {
double t = v / 9.8;
double y = t * t * 4.9;
int ans = 0;
rep(i, 1, 600) {
double h = 5 * (i - 1);
if (h > y) {
ans = i;
break;
}
}
cout << ans << endl;
}
}
|
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 52, 8, 9, 0, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 9, 0, 43, 39, 40]]
| 1
| 96
|
#include <cmath>
#include <iostream>
using namespace std;
/*
v = 9.8t
y = 4.8t^2
割れる速度になるtを求め、その時間でどのくらいの距離になるか計算する。
*/
int main() {
double v;
while (cin >> v) {
double t = v / 9.8;
double y = 4.8 * t * t;
int N = static_cast<int>(ceil(y / 5) + 1);
cout << N << endl;
}
}
|
#include <cmath>
#include <iostream>
using namespace std;
/*
v = 9.8t
y = 4.8t^2
割れる速度になるtを求め、その時間でどのくらいの距離になるか計算する。
*/
int main() {
double v;
while (cin >> v) {
double t = v / 9.8;
double y = 4.9 * t * t;
int N = static_cast<int>(ceil(y / 5)) + 1;
cout << N << endl;
}
}
|
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 31, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 31, 13], ["+", 31, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
| 1
| 66
|
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <typeinfo>
#include <vector>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;
int v;
int main() {
while (cin >> v) {
int ans = 1.0 * v * v / (5 * 19.6) + 1;
cout << ans + 1 << endl;
}
return 0;
}
|
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <typeinfo>
#include <vector>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;
double v;
int main() {
while (cin >> v) {
int ans = 1.0 * v * v / (5 * 19.6) + 1.0;
cout << ans + 1 << endl;
}
return 0;
}
|
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
| 1
| 120
|
#include <bits/stdc++.h>
using namespace std;
int main() {
double v, y;
int n;
while (cin >> v) {
y = v * v / 19.6;
n = (y - 1) / 5;
cout << n + 2 << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
double v, y;
int n;
while (cin >> v) {
y = v * v / 19.6;
n = (y - 0.0000000001) / 5;
cout << n + 2 << endl;
}
return 0;
}
|
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]]
| 1
| 57
|
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a, b) (fabs((a) - (b)) < EPS)
int main() {
double v;
while (cin >> v) {
int n = 0;
while (n - v * v / 98 + 1.0 < EPS)
++n;
cout << n << endl;
}
return 0;
}
|
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a, b) (fabs((a) - (b)) < EPS)
int main() {
double v;
while (cin >> v) {
int n = 0;
while (n - v * v / 98 - 1.0 < EPS)
++n;
cout << n << endl;
}
return 0;
}
|
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 33]]
| 1
| 88
|
#include <iostream>
using namespace std;
int main() {
double a, b, c;
while (cin >> a) {
b = 0;
int s = 0;
while (1) {
if (9.8 * b >= a)
break;
b += 0.01;
}
while (1) {
if (4.9 * b * b <= s)
break;
s += 5;
}
cout << s / 5 + 1 << endl;
}
}
|
#include <iostream>
using namespace std;
int main() {
double a, b, c;
while (cin >> a) {
b = 0;
int s = 0;
while (1) {
if (9.8 * b >= a)
break;
b += 0.0000001;
}
while (1) {
if (4.9 * b * b <= s)
break;
s += 5;
}
cout << s / 5 + 1 << endl;
}
}
|
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
| 1
| 88
|
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on
void solve() {
double v;
while (cin >> v) {
double t = v / 9.8;
double y = 4.9 * t * t;
cout << ((int)ceil(y) + 10) / 5 << endl;
}
}
|
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on
void solve() {
double v;
while (cin >> v) {
double t = v / 9.8;
double y = 4.9 * t * t;
cout << ((int)ceil(y) + 9) / 5 << endl;
}
}
|
[["-", 31, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 12, 13]]
| 1
| 408
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
double v, y;
cin >> v;
y = 4.9 * pow(v / 9.8, 2);
int n;
for (n = 0;; n++) {
if (y <= 5 * n - 5)
break;
}
cout << n << endl;
return 0;
}
// 25.4
// 32
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
double v, y;
while (cin >> v) {
y = 4.9 * pow(v / 9.8, 2);
int n;
for (n = 0;; n++) {
if (y <= 5 * n - 5)
break;
}
cout << n << endl;
}
return 0;
}
// 25.4
// 32
|
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
| 1
| 74
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
double v, y;
while (cin >> v) {
y = 4.9 * pow(v / 9.8, 2);
int n = 0;
while (n++)
if (y <= 5 * n - 5)
break;
cout << n << endl;
}
return 0;
}
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
double v, y;
while (cin >> v) {
y = 4.9 * pow(v / 9.8, 2);
int n = 0;
for (n;; n++)
if (y <= 5 * n - 5)
break;
cout << n << endl;
}
return 0;
}
|
[["-", 8, 9, 0, 52, 8, 9, 0, 52, 0, 89], ["+", 8, 9, 0, 52, 8, 9, 0, 7, 0, 88], ["+", 8, 9, 0, 52, 8, 9, 0, 7, 10, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 7, 0, 35]]
| 1
| 71
|
#include <iostream>
main() {
for (double v; std::cin >> v;)
std::cout << (int)v * v / 98 + 2 << "\n";
}
|
#include <iostream>
main() {
for (double v; std::cin >> v;)
std::cout << (int)(v * v / 98 + 2) << "\n";
}
|
[["+", 0, 16, 31, 16, 12, 74, 51, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 74, 51, 23, 0, 25]]
| 1
| 38
|
#include <iostream>
using namespace std;
int main() {
double v0;
while (scanf("%lf ", &v0) == 1) {
cout << (int)((v0 * v0) / (5.0 * 4.0 * 4.9)) + 1 << endl;
}
}
|
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
double v0;
while (scanf("%lf ", &v0) == 1) {
cout << (int)((v0 * v0) / (5.0 * 4.0 * 4.9)) + 2 << endl;
}
}
|
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
| 1
| 56
|
#include <iostream>
using namespace std;
int main(void) {
double v;
while (cin >> v) {
double t = v / 9.8;
int y = (4.9 * t * t) + 4;
cout << y / 5 + 1 << endl;
}
return 0;
}
|
#include <iostream>
using namespace std;
int main(void) {
double v;
while (cin >> v) {
double t = v / 9.8;
int y = (4.9 * t * t) + 5;
cout << y / 5 + 1 << endl;
}
return 0;
}
|
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
| 1
| 57
|
#include <stdio.h>
int main() {
int n;
double v, y;
while (scanf("%lf", &v) != EOF) {
y = (v / 2.0) * (v / 9.8);
n = (y + 5) / 5;
printf("%d\n", n);
}
return 0;
}
|
#include <stdio.h>
int main() {
int n;
double v, y;
while (scanf("%lf", &v) != EOF) {
y = (v / 2.0) * (v / 9.8);
n = (y + 5) / 5;
printf("%d\n", n + 1);
}
return 0;
}
|
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
| 1
| 69
|
#include <cstdio>
#include <iostream>
#include <math.h>
using namespace std;
int main(void) {
double v;
while (cin >> v) {
double n, k;
n = (4.9 * (v / 9.8) * (v / 9.8) + 5) / 5;
k = n - (int)n;
if (0 == k)
;
else {
n++;
}
cout << n << endl;
}
return 0;
}
|
#include <cstdio>
#include <iostream>
#include <math.h>
using namespace std;
int main(void) {
double v;
while (cin >> v) {
double n, k;
n = (4.9 * (v / 9.8) * (v / 9.8) + 5) / 5;
k = n - (int)n;
if (0 == k)
;
else {
n++;
}
cout << (int)n << endl;
}
return 0;
}
|
[["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 24], ["+", 0, 16, 31, 16, 12, 74, 39, 77, 39, 40], ["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 25]]
| 1
| 86
|
#include <iostream>
using namespace std;
int main(void) {
double v, t, y, N;
cin >> v;
t = v / 9.8;
y = 4.9 * t * t;
N = (y + 5) / 5;
cout << (int)++N << endl;
return 0;
}
|
#include <iostream>
using namespace std;
int main(void) {
double v, t, y, N;
while (cin >> v) {
t = v / 9.8;
y = 4.9 * t * t;
N = (y + 5) / 5;
cout << (int)++N << endl;
}
return 0;
}
|
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
| 1
| 63
|
#include <iostream>
using namespace std;
int main() {
double v, y;
int n;
while (cin >> v) {
y = (v * v) / 19.6;
n = y / 5 + 2;
cout << n;
}
return 0;
}
|
#include <iostream>
using namespace std;
int main() {
double v, y;
int n;
while (cin >> v) {
y = (v * v) / 19.6;
n = y / 5 + 2;
cout << n << endl;
}
return 0;
}
|
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
| 1
| 53
|
(gets.to_i).times do
xa,ya,ra,xb,yb,rb=gets.chomp.split(nil).map(&:to_f)
r=Math::sqrt((xa-xb)**2+(ya-yb)**2)
if(d+rb)<ra
puts 2
elsif(d+ra)<rb
puts -2
elsif d<(ra+rb)
puts 1
else
puts 0
end
end
|
(gets.to_i).times do
xa,ya,ra,xb,yb,rb=gets.chomp.split(nil).map(&:to_f)
r=Math::sqrt((xa-xb)**2+(ya-yb)**2)
if(r+rb)<ra
puts 2
elsif(r+ra)<rb
puts -2
elsif r<=(ra+rb)
puts 1
else
puts 0
end
end
|
[["-", 0, 121, 15, 738, 31, 739, 0, 738, 31, 22], ["+", 0, 121, 15, 738, 31, 739, 0, 738, 31, 22], ["-", 75, 759, 15, 738, 31, 739, 0, 738, 31, 22], ["+", 75, 759, 15, 738, 31, 739, 0, 738, 31, 22], ["-", 0, 121, 75, 759, 75, 759, 15, 738, 31, 22], ["-", 0, 121, 75, 759, 75, 759, 15, 738, 17, 18], ["+", 0, 121, 75, 759, 75, 759, 15, 738, 31, 22], ["+", 0, 121, 75, 759, 75, 759, 15, 738, 17, 19]]
| 4
| 92
|
while n = gets
n.to_i.times{
xa,ya,ra,xb,yb,rb = gets.split.map(&:to_f)
dist = ((xa-xb)**2+(ya-yb)**2)**0.5
if dist > ra+rb then
puts 0
elsif rb < ra and dist < rb-ra
puts 2
elsif ra < rb and dist < rb-ra
puts -2
else
puts 1
end
}
end
|
while n = gets
n.to_i.times{
xa,ya,ra,xb,yb,rb = gets.split.map(&:to_f)
dist = ((xa-xb)**2+(ya-yb)**2)**0.5
if dist > ra+rb then
puts 0
elsif rb < ra and dist < ra-rb
puts 2
elsif ra < rb and dist < rb-ra
puts -2
else
puts 1
end
}
end
|
[["-", 75, 759, 15, 738, 12, 738, 12, 738, 31, 22], ["-", 75, 759, 15, 738, 12, 738, 12, 738, 17, 33], ["+", 75, 759, 15, 738, 12, 738, 12, 738, 17, 33], ["+", 75, 759, 15, 738, 12, 738, 12, 738, 12, 22]]
| 4
| 92
|
class Circle
def compare(list)
xa, ya, ra, xb, yb, rb = list
cd = center_distance(xa, ya, xb, yb)
return 0 if cd > (ra - rb).abs
return 2 if cd + rb < ra
return -2 if cd + ra < rb
0
end
def center_distance(xa, ya, xb, yb)
((ya - yb)**2 + (xa - xb)**2)**(1 / 2.0)
end
end
n = STDIN.gets.chomp.to_i
inputs = STDIN.read.split("\n").map { |e| e.split.map { |e| e.chomp.to_f } }
n.times do |i|
puts Circle.new.compare(inputs[i])
end
|
class Circle
def compare(list)
xa, ya, ra, xb, yb, rb = list
cd = center_distance(xa, ya, xb, yb)
return 0 if cd > ra + rb
return 2 if cd + rb < ra
return -2 if cd + ra < rb
1
end
def center_distance(xa, ya, xb, yb)
((ya - yb)**2 + (xa - xb)**2)**(1 / 2.0)
end
end
n = STDIN.gets.chomp.to_i
inputs = STDIN.read.split("\n").map { |e| e.split.map { |e| e.chomp.to_f } }
n.times do |i|
puts Circle.new.compare(inputs[i])
end
|
[["-", 0, 751, 15, 738, 12, 652, 486, 739, 0, 24], ["-", 15, 738, 12, 652, 486, 739, 0, 738, 17, 33], ["+", 8, 736, 0, 751, 15, 738, 12, 738, 17, 72], ["-", 0, 751, 15, 738, 12, 652, 486, 739, 0, 25], ["-", 8, 736, 0, 751, 15, 738, 12, 652, 17, 131], ["-", 8, 736, 0, 751, 15, 738, 12, 652, 735, 22], ["-", 0, 269, 8, 736, 0, 735, 8, 736, 0, 612], ["+", 0, 269, 8, 736, 0, 735, 8, 736, 0, 612]]
| 4
| 162
|
n = readline.chomp.to_i
n.times do |i|
(xa, ya, ra, xb, yb, rb) = file.readline.chomp.split(' ').map(&:to_f)
l = Math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
r = ra + rb
if r < l
p 0
elsif (ra - rb).abs <= l and l <= ra + rb
p 1
else
if rb > ra
p 2
else
p -2
end
end
end
|
n = readline.chomp.to_i
n.times do |i|
(xa, ya, ra, xb, yb, rb) = readline.chomp.split(' ').map(&:to_f)
l = Math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
r = ra + rb
if r < l
p 0
elsif (ra - rb).abs <= l and l <= ra + rb
p 1
else
if ra > rb
p 2
else
p -2
end
end
end
|
[["-", 12, 652, 486, 652, 486, 652, 486, 652, 486, 22], ["-", 12, 652, 486, 652, 486, 652, 486, 652, 17, 131], ["-", 75, 759, 75, 95, 0, 121, 15, 738, 31, 22], ["-", 75, 759, 75, 95, 0, 121, 15, 738, 17, 47], ["+", 75, 759, 75, 95, 0, 121, 15, 738, 17, 47], ["+", 75, 759, 75, 95, 0, 121, 15, 738, 12, 22]]
| 4
| 111
|
def euclidean_distance(p1, p2)
sum_of_squares = 0
p1.each_with_index do |p1_coord, index|
sum_of_squares += (p1_coord - p2[index]) ** 2
end
Math.sqrt(sum_of_squares)
end
gets.to_i.times do
input = gets.split.map(&:to_f)
center_a = input[0..1]
radius_a = input[2]
center_b = input[3..4]
radius_b = input[5]
distance = euclidean_distance(center_a, center_b)
if distance > radius_a + radius_b
puts "0" # A and B do not overlap
elsif radius_a > radius_b + distance
puts "2" # B is in A
elsif radius_b > radios_a + distance
puts "-2" # A is in B
else
puts "1" # A and B intersect
end
end
|
def euclidean_distance(p1, p2)
sum_of_squares = 0
p1.each_with_index do |p1_coord, index|
sum_of_squares += (p1_coord - p2[index]) ** 2
end
Math.sqrt(sum_of_squares)
end
gets.to_i.times do
input = gets.split.map(&:to_f)
center_a = input[0..1]
radius_a = input[2]
center_b = input[3..4]
radius_b = input[5]
distance = euclidean_distance(center_a, center_b)
if distance > radius_a + radius_b
puts 0 # A and B do not overlap
elsif radius_a > radius_b + distance
puts 2 # B is in A
elsif radius_b > radius_a + distance
puts -2 # A is in B
else
puts 1 # A and B intersect
end
end
|
[["-", 64, 749, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 75, 759, 75, 759, 15, 738, 12, 738, 31, 22], ["+", 75, 759, 75, 759, 15, 738, 12, 738, 31, 22], ["-", 64, 749, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 64, 749, 0, 652, 3, 4, 0, 748, 17, 33], ["+", 64, 749, 0, 652, 3, 4, 0, 748, 439, 612], ["-", 75, 95, 0, 652, 3, 4, 0, 557, 0, 62]]
| 4
| 133
|
#!/usr/local/bin/ruby
n=gets.to_i
n.times{
xa,ya,ra,xb,yb,rb=gets.split.map(&:to_f)
d=Math.sqrt((ya-xa)**2+(yb-ya)**2)
if d < ra-rb
puts "2"
elsif d < rb-ra
puts"-2"
elsif d > ra +rb
puts"0"
else
puts "1"
end
}
|
#!/usr/local/bin/ruby
n=gets.to_i
n.times{
xa,ya,ra,xb,yb,rb=gets.split.map(&:to_f)
d=Math.sqrt((xb-xa)**2+(yb-ya)**2)
if d < ra-rb
puts "2"
elsif d < rb-ra
puts"-2"
elsif d > ra +rb
puts"0"
else
puts "1"
end
}
|
[["-", 0, 738, 31, 738, 31, 739, 0, 738, 31, 22], ["+", 0, 738, 31, 738, 31, 739, 0, 738, 31, 22]]
| 4
| 90
|
def length(xa, ya, xb, yb)
Math.sqrt((xa - xb)**2 + (ya - yb)**2)
end
n = gets.to_i
while gets
xa, ya, ra, xb, yb, rb = $_.split(' ').map(&:to_f)
l = length(xa, ya, xb, yb)
if ra > l + rb
out = 2
elsif rb > l + ra
out = -2
elsif ra + rb == l
out = 1
else
out = 0
end
puts out
end
|
def length(xa, ya, xb, yb)
Math.sqrt((xa - xb)**2 + (ya - yb)**2)
end
n = gets.to_i
while gets
xa, ya, ra, xb, yb, rb = $_.split(' ').map(&:to_f)
l = length(xa, ya, xb, yb)
if ra > l + rb
out = 2
elsif rb > l + ra
out = -2
elsif ra + rb < l
out = 0
else
out = 1
end
puts out
end
|
[["-", 0, 121, 75, 759, 75, 759, 15, 738, 17, 60], ["+", 0, 121, 75, 759, 75, 759, 15, 738, 17, 18], ["-", 75, 759, 75, 759, 64, 749, 0, 662, 12, 612], ["+", 75, 759, 75, 759, 64, 749, 0, 662, 12, 612], ["-", 75, 759, 75, 759, 75, 95, 0, 662, 12, 612], ["+", 75, 759, 75, 759, 75, 95, 0, 662, 12, 612]]
| 4
| 113
|
n = gets.to_i
n.times do
xa, ya, ra, xb, yb, rb = gets.split.map(&:to_f)
d = Math.sqrt( (xa - xb) ** 2 - (ya - yb) ** 2 )
if ra > rb + d then
puts 2
elsif rb > ra + d then
puts -2
elsif d <= ra + rb then
puts 1
else
puts 0
end
end
|
n = gets.to_i
n.times do
xa, ya, ra, xb, yb, rb = gets.split.map(&:to_f)
d = Math.sqrt( (xa - xb) ** 2 + (ya - yb) ** 2 )
if ra > rb + d then
puts 2
elsif rb > ra + d then
puts -2
elsif d <= ra + rb then
puts 1
else
puts 0
end
end
|
[["-", 0, 662, 12, 652, 3, 4, 0, 738, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 738, 17, 72]]
| 4
| 85
|
def relation(xa, ya, ra, xb, yb, rb)
d = ((xa - xb) ** 2 + (ya - yb) ** 2) ** 0.5
return 0 if ra + rb <= d
return 2 if d + rb <= ra
return -2 if d + ra <= rb
return 1
end
$<.gets.to_i.times do
p relation(*$<.gets.split.map(&:to_i))
end
|
def relation(xa, ya, ra, xb, yb, rb)
d = ((xa - xb) ** 2 + (ya - yb) ** 2) ** 0.5
return 0 if ra + rb < d
return 2 if d + rb < ra
return -2 if d + ra < rb
return 1
end
$<.gets.to_i.times do
p relation(*$<.gets.split.map(&:to_f))
end
|
[["-", 0, 735, 8, 736, 0, 751, 15, 738, 17, 19], ["+", 0, 735, 8, 736, 0, 751, 15, 738, 17, 18], ["-", 0, 741, 0, 652, 3, 4, 0, 752, 0, 753], ["+", 0, 741, 0, 652, 3, 4, 0, 752, 0, 753]]
| 4
| 89
|
class Vector
attr_accessor :x, :y
def initialize(x, y)
@x = x
@y = y
end
def length()
Math.sqrt(@x**2 + @y**2)
end
def self.minus(v1, v2)
return Vector.new(v1.x - v2.x, v1.y - v2.y)
end
end
if __FILE__ == $0
n = gets.to_i
n.times do
xa, ya, ra, xb, yb, rb = gets.split.map{|i| i.to_f}
v1 = Vector.new(xa, ya)
v2 = Vector.new(xb, yb)
dist = Vector.minus(v1, v2).length()
if (dist + rb) <= ra
puts "2"
elsif (dist + ra) <= rb
puts "-2"
elsif dist == (ra + rb)
puts "1"
else
puts "0"
end
end
end
|
class Vector
attr_accessor :x, :y
def initialize(x, y)
@x = x
@y = y
end
def length()
Math.sqrt(@x**2 + @y**2)
end
def self.minus(v1, v2)
return Vector.new(v1.x - v2.x, v1.y - v2.y)
end
end
if __FILE__ == $0
n = gets.to_i
n.times do
xa, ya, ra, xb, yb, rb = gets.split.map{|i| i.to_f}
v1 = Vector.new(xa, ya)
v2 = Vector.new(xb, yb)
dist = Vector.minus(v1, v2).length()
if (dist + rb) < ra
puts "2"
elsif (dist + ra) < rb
puts "-2"
elsif dist <= (ra + rb)
puts "1"
else
puts "0"
end
end
end
|
[["-", 196, 737, 8, 736, 0, 121, 15, 738, 17, 19], ["+", 196, 737, 8, 736, 0, 121, 15, 738, 17, 18], ["-", 8, 736, 0, 121, 75, 759, 15, 738, 17, 19], ["+", 8, 736, 0, 121, 75, 759, 15, 738, 17, 18], ["-", 0, 121, 75, 759, 75, 759, 15, 738, 17, 60], ["+", 0, 121, 75, 759, 75, 759, 15, 738, 17, 19]]
| 4
| 185
|
import math
for i in range(int(input())):
xa, ya, ra, xb, yb, rb = list(map(float, input().split()))
d1 = (xa - xb) ** 2 + (ya - yb) ** 2
d2 = ra ** 2 + rb ** 2
dr = (ra-rb) ** 2
if d1 <= d2:
if dr >= d1:
print(2 if ra > rb else -2)
else:
print(1)
else:
print(0)
|
import math
for i in range(int(input())):
xa, ya, ra, xb, yb, rb = list(map(float, input().split()))
d1 = (xa - xb) ** 2 + (ya - yb) ** 2
d2 = (ra + rb) ** 2
dr = (ra-rb) ** 2
if d1 <= d2:
if dr > d1:
print(2 if ra > rb else -2)
else:
print(1)
else:
print(0)
|
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 578], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 47]]
| 5
| 110
|
from fractions import Fraction as F
for _ in range(eval(input())):
x1, y1, r1, x2, y2, r2 = list(map(F, input().split()))
d = (x1+x2)**2+(y1+y2)**2
if d < (r1-r2)**2:
print(2 if r1 > r2 else -2)
elif (r1-r2)**2 <= d <= (r1+r2)**2:
print(1)
else:
print(0)
|
from fractions import Fraction as F
for _ in range(eval(input())):
x1, y1, r1, x2, y2, r2 = list(map(F, input().split()))
d = (x1-x2)**2+(y1-y2)**2
if d < (r1-r2)**2:
print(2 if r1 > r2 else -2)
elif (r1-r2)**2 <= d <= (r1+r2)**2:
print(1)
else:
print(0)
|
[["-", 12, 657, 31, 657, 31, 23, 0, 657, 17, 72], ["+", 12, 657, 31, 657, 31, 23, 0, 657, 17, 33], ["-", 12, 657, 12, 657, 31, 23, 0, 657, 17, 72], ["+", 12, 657, 12, 657, 31, 23, 0, 657, 17, 33]]
| 5
| 114
|
import math
def length(xa, ya, xb, yb):
return math.sqrt((xa - xb)**2 + (ya - yb)**2)
n = int(input())
for s in range(0, n):
xa, ya, ra, xb, yb, rb = list(map(float, input().split(' ')))
d = length(xa, ya, xb, yb)
if ra > rb + d:
print(2)
elif rb > ra + d:
print(-2)
elif d < ra + rb:
print(0)
else:
print(1)
|
import math
def length(xa, ya, xb, yb):
return math.sqrt((xa - xb)**2 + (ya - yb)**2)
n = int(input())
for s in range(0, n):
xa, ya, ra, xb, yb, rb = list(map(float, input().split(' ')))
d = length(xa, ya, xb, yb)
if ra > rb + d:
print(2)
elif rb > ra + d:
print(-2)
elif d > ra + rb:
print(0)
else:
print(1)
|
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 47]]
| 5
| 135
|
(function(input) {
var p = input.replace(/\n$/, '').split('\n').map(Number);
var n = p.length;
var G = 9.8;
for (var i = 0; i < n; i++) {
var mv = p.shift();
var t = mv / G;
var N = (G / 2 * t * t + 5) / 5;
console.log(Math.round(N));
}
})(require('fs').readFileSync('/dev/stdin', 'utf8'));
|
(function(input) {
var p = input.replace(/\n$/, '').split('\n').map(Number);
var n = p.length;
var G = 9.8;
for (var i = 0; i < n; i++) {
var mv = p.shift();
var t = mv / G;
var N = (G / 2 * t * t + 5) / 5;
console.log(Math.ceil(N));
}
})(require('fs').readFileSync('/dev/stdin', 'utf8'));
|
[["-", 0, 2, 3, 3, 0, 2, 63, 558, 559, 560], ["+", 0, 2, 3, 3, 0, 2, 63, 558, 559, 560]]
| 2
| 128
|
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.trim().split('\n');
var line;
while (line = lines.shift()) {
var speed = +line;
for (var f = 1; f < 50; f++) {
var t = Math.sqrt((f * 5 - 5) / 4.9);
var v = 9.8 * t;
if (v >= speed) {
console.log(f);
break;
}
}
}
|
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.trim().split('\n');
var line;
while (line = lines.shift()) {
var speed = +line;
for (var f = 1;; f++) {
var t = Math.sqrt((f * 5 - 5) / 4.9);
var v = 9.8 * t;
if (v >= speed) {
console.log(f);
break;
}
}
}
|
[["-", 8, 556, 0, 7, 15, 1, 0, 16, 31, 22], ["-", 8, 556, 0, 7, 15, 1, 0, 16, 17, 18], ["-", 8, 556, 0, 7, 15, 1, 0, 16, 12, 555]]
| 2
| 116
|
import java.util.Scanner;
public class Main {
private Scanner sc;
public static void main(String[] args) { new Main(); }
public Main() {
sc = new Scanner(System.in);
String str = "";
while (sc.hasNextLine() == true) {
str = sc.nextLine();
double maxv = Double.parseDouble(str);
double t = maxv / 9.8;
double d = 4.9 * t * t;
int f = (int)(d / 5) + 1;
System.out.println(f);
}
}
}
|
import java.util.Scanner;
public class Main {
private Scanner sc;
public static void main(String[] args) { new Main(); }
public Main() {
sc = new Scanner(System.in);
String str = "";
while (sc.hasNextLine() == true) {
str = sc.nextLine();
double maxv = Double.parseDouble(str);
double t = maxv / 9.8;
double d = 4.9 * t * t;
int f = (int)Math.ceil(d / 5) + 1;
System.out.println(f);
}
}
}
|
[["+", 49, 200, 51, 16, 31, 74, 51, 492, 500, 22], ["+", 49, 200, 51, 16, 31, 74, 51, 492, 0, 131], ["+", 49, 200, 51, 16, 31, 74, 51, 492, 141, 22]]
| 3
| 124
|
import java.util.*;
class Main {
public static void main(String[] z) {
for (Scanner s = new Scanner(System.in); s.hasNext();)
System.out.println(
(int)Math.ceil(Math.pow(s.nextDouble(), 2) / 19.6 + 5) / 5);
}
}
|
import java.util.*;
class Main {
public static void main(String[] z) {
for (Scanner s = new Scanner(System.in); s.hasNext();)
System.out.println(
(int)Math.ceil((Math.pow(s.nextDouble(), 2) / 19.6 + 5) / 5));
}
}
|
[["+", 51, 492, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 74, 51, 492, 3, 4, 0, 25]]
| 3
| 77
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String out = "";
while (scanner.hasNext()) {
double v = scanner.nextDouble();
for (int n = 1;; n++) {
double vv = 9.8 * Math.sqrt((5 * n - 5) / 4.9);
if (vv >= v) {
out = n + "\n";
break;
}
}
}
System.out.print(out);
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String out = "";
while (scanner.hasNext()) {
double v = scanner.nextDouble();
for (int n = 1;; n++) {
double vv = 9.8 * Math.sqrt((5 * n - 5) / 4.9);
if (vv >= v) {
out += n + "\n";
break;
}
}
}
System.out.print(out);
}
}
|
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 17, 107]]
| 3
| 119
|
#include <stdio.h>
int main() {
double v, y;
unsigned long long int n;
while (scanf("%lf", &v) != EOF) {
y = v / 19.6 * v;
if ((int)y % 5)
n = (int)(y / 5) + 2;
else
n = (int)(y / 5) + 1;
printf("%llu\n", n);
}
return 0;
}
|
#include <stdio.h>
int main() {
double v, y;
unsigned long long int n;
while (scanf("%lf", &v) != EOF) {
y = v / 19.6 * v;
if (y - y / 5)
n = (int)(y / 5) + 2;
else
n = (int)(y / 5) + 1;
printf("%llu\n", n);
}
return 0;
}
|
[["-", 0, 57, 15, 23, 0, 16, 31, 74, 0, 24], ["-", 15, 23, 0, 16, 31, 74, 39, 77, 39, 40], ["-", 0, 57, 15, 23, 0, 16, 31, 74, 0, 25], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 109], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 33], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 85]]
| 0
| 92
|
#include <stdio.h>
int main() {
double v, y;
unsigned long long int n;
while (scanf("%lf", &v) != EOF) {
y = v / 19.6 * v;
if ((int)y % 5)
n = (int)(y / 5) + 2;
else
n = (int)(y / 5) + 1;
printf("%llu\n", n);
}
return 0;
}
|
#include <stdio.h>
int main() {
double v, y;
unsigned long long int n;
while (scanf("%lf", &v) != EOF) {
y = v / 19.6 * v;
if (y - (int)y / 5)
n = (int)(y / 5) + 2;
else
n = (int)(y / 5) + 1;
printf("%llu\n", n);
}
return 0;
}
|
[["+", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 33], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 109], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 85]]
| 0
| 92
|
#include <stdio.h>
int main() {
double v, y;
unsigned long long int n;
while (scanf("%lf", &v) != EOF) {
y = v / 19.6 * v;
if ((int)y % 5)
n = (int)(y / 5) + 2;
else
n = (int)(y / 5) + 1;
printf("%llu\n", n);
}
return 0;
}
|
#include <stdio.h>
int main() {
double v, y;
unsigned long long int n;
while (scanf("%lf", &v) != EOF) {
y = v / 19.6 * v;
if (y - (int)y / 5 * 5)
n = (int)(y / 5) + 2;
else
n = (int)(y / 5) + 1;
printf("%llu\n", n);
}
return 0;
}
|
[["+", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 33], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 109], ["+", 15, 23, 0, 16, 12, 16, 31, 16, 17, 85], ["+", 15, 23, 0, 16, 12, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 48]]
| 0
| 92
|
#include <math.h>
#include <stdio.h>
int main(void) {
long long int kai, N;
double h, v, t, t2, speed;
while (scanf("%lf", &speed) != EOF) {
for (N = 1;; N++) {
kai = 5 * N;
h = kai - 5;
t2 = h / 4.9;
t = sqrt(t2);
v = 9.8 * t;
if (v > speed)
break;
}
printf("%d", N);
}
return 0;
}
|
#include <math.h>
#include <stdio.h>
int main(void) {
long long int kai, N;
double h, v, t, t2, speed;
while (scanf("%lf", &speed) != EOF) {
for (N = 1;; N++) {
kai = 5 * N;
h = kai - 5;
t2 = h / 4.9;
t = sqrt(t2);
v = 9.8 * t;
if (v > speed)
break;
}
printf("%d\n", N);
}
return 0;
}
|
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
| 0
| 108
|
#include <stdio.h>
int main(void) {
int i, max = 0;
double v[50];
for (i = 0; i < 50; i++) {
int ret = scanf("%lf", &v[i]);
if (ret == EOF)
break;
if (i > max)
max = i;
}
int N[50];
double t[50], t2[50], y[50], n[50];
for (i = 0; i <= max; i++) {
t[i] = v[i] / 9.8;
t2[i] = t[i] * t[i];
y[i] = 4.9 * t2[i];
n[i] = (y[i] + 5.0) / 5.0;
N[i] = n[i] + 0.5;
printf("%d\n", N[i]);
}
return 0;
}
|
#include <stdio.h>
int main(void) {
int i, max = 0;
double v[50];
for (i = 0; i < 50; i++) {
int ret = scanf("%lf", &v[i]);
if (ret == EOF)
break;
if (i > max)
max = i;
}
int N[50];
double t[50], t2[50], y[50], n[50];
for (i = 0; i <= max; i++) {
t[i] = v[i] / 9.8;
t2[i] = t[i] * t[i];
y[i] = 4.9 * t2[i];
n[i] = (y[i] + 5.0) / 5.0;
N[i] = n[i] + 1.0;
printf("%d\n", N[i]);
}
return 0;
}
|
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
| 0
| 196
|
#include <stdio.h>
main() {
double v, nv, t;
int n, i;
while (1) {
if (scanf("%lf", &nv) == EOF)
break;
nv = nv * nv;
for (i = 1;; i++) {
t = ((double)i - 1.0) * 5.0 / 4.9;
v = 9.8 * 9.8 * t;
if (v >= nv) {
printf("%d", i);
break;
}
}
}
return 0;
}
|
#include <stdio.h>
main() {
double v, nv, t;
int n, i;
while (1) {
if (scanf("%lf", &nv) == EOF)
break;
nv = nv * nv;
for (i = 1;; i++) {
t = ((double)i - 1.0) * 5.0 / 4.9;
v = 9.8 * 9.8 * t;
if (v >= nv) {
printf("%d\n", i);
break;
}
}
}
return 0;
}
|
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
| 0
| 105
|
float v;
main() {
for (; ~scanf("%f", &v);)
printf("%g\n", v * v / 98 + 2);
}
|
float v;
main(i) {
for (; ~scanf("%f", &v);)
printf("%d\n", i = v * v / 98 + 2);
}
|
[["+", 36, 36, 0, 30, 0, 14, 49, 65, 0, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 11, 31, 22], ["+", 8, 1, 0, 2, 3, 4, 0, 11, 17, 32]]
| 0
| 40
|
#include <stdio.h>
int main(int argc, const char *argv[]) {
float value;
double y, t;
int n;
while (scanf("%f", &value) != EOF) {
t = 0.0;
n = 0;
t = value / 9.8;
y = 4.9 * t * t;
n = (y + 5) / 5;
printf("b%d\n", n + 1);
}
return 0;
}
|
#include <stdio.h>
int main(int argc, const char *argv[]) {
float value;
double y, t;
int n;
while (scanf("%f", &value) != EOF) {
t = 0.0;
n = 0;
t = value / 9.8;
y = 4.9 * t * t;
n = (y + 5) / 5;
printf("%d\n", n + 1);
}
return 0;
}
|
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
| 0
| 91
|
int main(void) {
float b;
int i;
while (~scanf("%f", &b)) {
b *= b / 98;
i = 0;
// while(++i-1<b);
printf("%d\n", i = b + 1);
}
return (0);
}
|
int main(void) {
float b;
int i;
while (~scanf("%f", &b)) {
b *= b / 98;
i = 0;
// while(++i<=b+1);
printf("%d\n", i = b + 2);
}
return (0);
}
|
[["-", 0, 2, 3, 4, 0, 11, 12, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 11, 12, 16, 12, 13]]
| 0
| 58
|
i;
main(float b) {
for (; i = ~scanf("%f", &b);)
printf("%.f\n", b * b / 98 + 2);
}
|
i;
main(float b) {
for (; i = ~scanf("%f", &b);)
printf("%d\n", i = b / 98 * b + 2);
}
|
[["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 31, 22], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 8, 1, 0, 2, 3, 4, 0, 11, 31, 22], ["+", 8, 1, 0, 2, 3, 4, 0, 11, 17, 32], ["+", 3, 4, 0, 11, 12, 16, 31, 16, 17, 48], ["+", 3, 4, 0, 11, 12, 16, 31, 16, 12, 22]]
| 0
| 43
|
#include <stdio.h>
int main(void) {
int n;
double y, v;
while (1) {
int c = scanf("%lf", &v);
if (c == EOF)
return 0;
y = 4.9 * (v / 9.8) * (v / 9.8);
n = 0;
while (1) {
if (5 * n - 5.5 >= y)
break;
n++;
}
printf("%d\n", n);
}
return 0;
}
|
#include <stdio.h>
int main(void) {
int n;
double y, v;
while (1) {
int c = scanf("%lf", &v);
if (c == EOF)
return 0;
y = 4.9 * (v / 9.8) * (v / 9.8);
n = 0;
while (1) {
if (5 * n - 5 >= y)
break;
n++;
}
printf("%d\n", n);
}
return 0;
}
|
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13]]
| 0
| 99
|
#include <stdio.h>
int main() {
double n, t, v, y;
while (scanf("%lf", &v) != EOF) {
t = v / 9.8;
y = 4.9 * t * t;
n = (y + 5) / 5;
printf("%.0lf\n", n);
}
return 0;
}
|
#include <stdio.h>
int main() {
double n, t, v, y;
while (scanf("%lf", &v) != EOF) {
t = v / 9.8;
y = 4.9 * t * t;
n = (y + 5) / 5;
printf("%.0lf\n", n + .5);
}
return 0;
}
|
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
| 0
| 70
|
#include <math.h>
#include <stdio.h>
int main() {
float v;
while (scanf("%f", &v) != EOF)
printf("%.f\n", ceil(v * v / 98) / 5 + 1);
return 0;
}
|
#include <math.h>
#include <stdio.h>
int main() {
float v;
while (scanf("%f", &v) != EOF)
printf("%.f\n", ceil(v * v / 98) + 1);
return 0;
}
|
[["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 85], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 13]]
| 0
| 51
|
#include <math.h>
#include <stdio.h>
int main() {
int i, n;
double v, t, y;
while (scanf("%lf", &v) != EOF) {
t = v / 9.8;
y = 4, 8 * t * t;
n = (int)ceil(((y + 5) / 5));
printf("%d\n", n);
}
return 0;
}
|
#include <math.h>
#include <stdio.h>
int main() {
int i, n;
double v, t, y;
while (scanf("%lf", &v) != EOF) {
t = v / 9.8;
y = 4.9 * t * t;
n = (int)ceil(((y + 5.0) / 5.0));
printf("%d\n", n);
}
return 0;
}
|
[["-", 8, 9, 0, 1, 0, 34, 31, 11, 12, 13], ["-", 0, 52, 8, 9, 0, 1, 0, 34, 0, 21], ["-", 0, 1, 0, 34, 12, 16, 31, 16, 31, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 13], ["-", 0, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["-", 51, 2, 3, 4, 0, 23, 0, 16, 12, 13], ["+", 51, 2, 3, 4, 0, 23, 0, 16, 12, 13]]
| 0
| 85
|
#include <stdio.h>
int main() {
double v, h, n;
int i;
while (scanf("%lf", &v) != EOF) {
h = v * v / 19.6;
i = 1;
n = 0.0;
while (1) {
i++;
if (n < h && (n + (double)(5 * (i - 1))) >= h) {
printf("%d\n", i);
break;
}
n += (double)(5 * (i - 1));
}
}
return 0;
}
|
#include <stdio.h>
int main() {
double v, h, n;
int i;
while (scanf("%lf", &v) != EOF) {
h = v * v / 19.6;
i = 1;
n = 0.0;
while (1) {
i++;
if (n < h && (double)(5 * (i - 1)) >= h) {
printf("%d\n", i);
break;
}
n = (double)(5 * (i - 1));
}
}
return 0;
}
|
[["-", 0, 16, 12, 16, 31, 23, 0, 16, 31, 22], ["-", 0, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 12, 16, 31, 23, 0, 16, 12, 74, 0, 24], ["-", 12, 74, 51, 23, 0, 16, 12, 23, 0, 25], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32]]
| 0
| 116
|
#include <math.h>
#include <stdio.h>
int main() {
double m, t, n;
while (scanf("%lf", &m) != EOF) {
t = m / 9.8;
n = (4.9 * t * t + 5.0) / 5.0;
printf("%d\n", ceil(n));
}
return 0;
}
|
#include <math.h>
#include <stdio.h>
int main() {
double m, t, n;
while (scanf("%lf", &m) != EOF) {
t = m / 9.8;
n = (4.9 * t * t + 5.0) / 5.0;
printf("%d\n", (int)ceil(n));
}
return 0;
}
|
[["+", 0, 1, 0, 2, 3, 4, 0, 74, 0, 24], ["+", 0, 2, 3, 4, 0, 74, 39, 77, 39, 40], ["+", 0, 1, 0, 2, 3, 4, 0, 74, 0, 25]]
| 0
| 69
|
#include <math.h>
#include <stdio.h>
int main(void) {
double v, y;
int n;
while (scanf("%lf", &v) != EOF) {
/* v = 9.8 * t
y = 4.9 * t^2 より
y = 4.9 * (v / 9.8)^2 */
y = 4.9 * pow((v / 9.8), 2);
/* 建物のN階の高さが
5 * N - 5 より
N = (y + 5) / 5 */
n = ceil((y + 5) / 5);
printf("%d", n);
}
return 0;
}
|
#include <math.h>
#include <stdio.h>
int main(void) {
double v, y;
int n;
while (scanf("%lf", &v) != EOF) {
/* v = 9.8 * t
y = 4.9 * t^2 より
y = 4.9 * (v / 9.8)^2 */
y = 4.9 * pow((v / 9.8), 2);
/* 建物のN階の高さYが
Y = 5 * N - 5 より
N = (Y + 5) / 5 */
n = (int)ceil((y + 5) / 5);
printf("%d\n", n);
}
return 0;
}
|
[["+", 8, 9, 0, 1, 0, 11, 12, 74, 0, 24], ["+", 0, 1, 0, 11, 12, 74, 39, 77, 39, 40], ["+", 8, 9, 0, 1, 0, 11, 12, 74, 0, 25], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
| 0
| 77
|
#include <stdio.h>
int main() {
double v, y;
double N;
int n;
while (scanf("%lf", &v) != EOF) {
y = 4.9 * (v / 9.8) * (v / 9.8);
N = (y + 5) / 5;
n = (y + 5) / 5;
if (n < N)
n++;
printf("%d", n);
}
return 0;
}
|
#include <stdio.h>
int main() {
double v, y;
double N;
int n;
while (scanf("%lf", &v) != EOF) {
y = 4.9 * (v / 9.8) * (v / 9.8);
N = (y + 5) / 5;
n = (y + 5) / 5;
if (n < N)
n++;
printf("%d\n", n);
}
return 0;
}
|
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
| 0
| 92
|
#include <math.h>
#include <stdio.h>
#define GRAVITY_ACC 9.8
#define GRAVITY_AC 4.9
main() {
double velocity = 0; //入力される速度
double time = 0, distance = 0, result = 0; // t, y, nに対応
int n = 0;
while (scanf("%lf", &velocity) != EOF) {
time = velocity / GRAVITY_ACC; // tの計算
distance = GRAVITY_AC * pow(time, 2);
result = (distance + 5) / 5;
n = result + 0.5;
printf("%d\n", n);
}
return 0;
}
|
#include <math.h>
#include <stdio.h>
#define GRAVITY_ACC 9.8
#define GRAVITY_AC 4.9
main() {
double velocity = 0; //入力される速度
double time = 0, distance = 0, result = 0; // t, y, nに対応
int n = 0;
while (scanf("%lf", &velocity) != EOF) {
time = velocity / GRAVITY_ACC; // tの計算
distance = GRAVITY_AC * pow(time, 2);
result = (distance + 5) / 5;
n = result + 1;
printf("%d\n", n);
}
return 0;
}
|
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
| 0
| 104
|
#include <cmath>
#include <iostream>
#define REP(i, s, n) for (int i = 0; i < n; i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
int main() {
long double n;
cin >> n;
// cout << n*n/19.6<<endl;
// cout << int(35.0+1.2)<<endl;
cout << int(n * n / 19.6 / 5 + 2) << endl;
return 0;
}
|
#include <cmath>
#include <iostream>
#define REP(i, s, n) for (int i = 0; i < n; i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
int main() {
long double n;
// cout << n*n/19.6<<endl;
// cout << int(35.0+1.2)<<endl;
while (cin >> n) {
cout << int(n * n / 19.6 / 5 + 2) << endl;
}
return 0;
}
|
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
| 1
| 62
|
#include <iostream>
using namespace std;
int main(void) {
double v;
double t; //球が割れるのに必要な最低速度になるのは落下し始めてから何秒後か
int y; // t秒後に物体が落下した距離
int N; //球が割れる建物の階の最小値
while (cin >> v) {
t = v / 9.8;
y = 4.9 * t * t;
N = ((y + 1) + 5) / 5;
cout << N + 1 << endl;
}
}
|
#include <iostream>
using namespace std;
int main(void) {
double v;
double t; //球が割れるのに必要な最低速度になるのは落下し始めてから何秒後か
double y; // t秒後に物体が落下した距離
int N; //球が割れる建物の階の最小値
while (cin >> v) {
t = v / 9.8;
y = 4.9 * t * t;
N = (y + 5) / 5;
cout << N + 1 << endl;
}
}
|
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["-", 31, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["-", 31, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["-", 12, 16, 31, 23, 0, 16, 31, 23, 0, 25]]
| 1
| 72
|
#include <math.h>
#include <stdio.h>
double dist(double x1, double y1, double x2, double y2) {
// return (pow(x1 - x2, 2) + pow(y1 - y2, 2));
return (hypot(x1 - x2, y1 - y2));
}
int main(void) {
double ax, ay;
double bx, by;
double ar, br;
double abdist;
int n, i;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &ax, &ay, &ar, &bx, &by, &br);
abdist = dist(ax, ay, bx, by);
if (abdist < ar || abdist < br) {
if (ar > br + abdist) {
puts("2");
} else if (br > ar + abdist) {
puts("-2");
} else {
puts("1");
}
} else {
puts("0");
}
}
return (0);
}
|
#include <math.h>
#include <stdio.h>
double dist(double x1, double y1, double x2, double y2) {
// return (pow(x1 - x2, 2) + pow(y1 - y2, 2));
return (hypot(x1 - x2, y1 - y2));
}
int main(void) {
double ax, ay;
double bx, by;
double ar, br;
double abdist;
int n, i;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &ax, &ay, &ar, &bx, &by, &br);
abdist = dist(ax, ay, bx, by);
if (abdist <= ar + br) {
if (ar > br + abdist) {
puts("2");
} else if (br > ar + abdist) {
puts("-2");
} else {
puts("1");
}
} else {
puts("0");
}
}
return (0);
}
|
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 106], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 72]]
| 0
| 201
|
#include <math.h>
#include <stdio.h>
#define sq(x) (x) * (x)
int main(void) {
int n, i;
double xa, ya, ra, xb, yb, rb;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
if ((sq(xa - xb) + sq(ya - yb)) < sq(rb - ra)) {
if (ra > rb) {
printf("-2\n");
continue;
}
if (rb > ra) {
printf("2\n");
}
}
if ((sq(xa - xb) + sq(ya - yb)) <= sq(ra + rb)) {
printf("1\n");
continue;
}
printf("0\n");
}
return 0;
}
|
#include <math.h>
#include <stdio.h>
#define sq(x) (x) * (x)
int main(void) {
int n, i;
double xa, ya, ra, xb, yb, rb;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
if ((sq(xa - xb) + sq(ya - yb)) < sq(rb - ra)) {
if (ra > rb) {
printf("2\n");
continue;
}
if (rb > ra) {
printf("-2\n");
continue;
}
}
if ((sq(xa - xb) + sq(ya - yb)) <= sq(ra + rb)) {
printf("1\n");
continue;
}
printf("0\n");
}
return 0;
}
|
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 64, 9, 0, 57, 64, 9, 0, 116, 0, 117]]
| 0
| 194
|
#include <math.h>
#include <stdio.h>
int main(void) {
int n;
double xa, ya, ra, xb, yb, rb, dis;
scanf("%d", &n);
while (n-- > 0) {
scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
dis = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
if (dis + ra < rb) {
puts("2");
} else if (dis + rb < ra) {
puts("-2");
} else if (ra + rb > dis) {
puts("1");
} else {
puts("0");
}
}
return 0;
}
|
#include <math.h>
#include <stdio.h>
int main(void) {
int n;
double xa, ya, ra, xb, yb, rb, dis;
scanf("%d", &n);
while (n-- > 0) {
scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
dis = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
if (dis + ra < rb) {
puts("-2");
} else if (dis + rb < ra) {
puts("2");
} else if (ra + rb >= dis) {
puts("1");
} else {
puts("0");
}
}
return 0;
}
|
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 20]]
| 0
| 168
|
#include <math.h>
#include <stdio.h>
#define FALSE 0
#define CROSS 1
#define A_IN_B -2
#define B_IN_A 2
#define OTHER -10
#define compile 0
struct circle {
double x; //中心のx座標
double y; //中心のy座標
double r; //円の半径
};
int func_judge(double ax, double ay, double ar, double bx, double by,
double br);
void func_output(int result);
main() {
int n = 0, i = 0; //データセット代入変数, 制御変数
int result = OTHER; //-2,0,1,2以外なら何でも良い
scanf("%d", &n);
for (i = 0; i < n; i++) {
struct circle a = {0, 0, 0}; //構造体変数の宣言(円a)
struct circle b = {0, 0, 0}; //構造体変数の宣言(円b)
scanf("%lf %lf %lf %lf %lf %lf", &a.x, &a.y, &a.r, &b.x, &b.y, &b.r); //入力
result = func_judge(a.x, a.x, a.r, b.x, b.y, b.r); //結果の計算
func_output(result);
result = OTHER;
}
return 0;
}
int func_judge(double ax, double ay, double ar, double bx, double by,
double br) {
double dis_a_to_b = 0; //円aと円bの距離を代入する変数
dis_a_to_b = sqrt(pow(ax - bx, 2) + pow(ay - by, 2)); //中心間の距離を計算
#if compile == 2
printf("dis_a_to_b = %lf ar = %lf br = %lf\n", dis_a_to_b, ar, br);
#endif
if (ar >
(br +
dis_a_to_b)) // aの半径rがbの半径rと円aと円bの中心座標の距離の和よりも大きい場合
{
return B_IN_A;
} else if (
br >
(ar +
dis_a_to_b)) // bの半径rがaの半径rと円aと円bの中心座標の距離の和よりも大きい場合
{
return A_IN_B;
} else if ((ar + br) <
dis_a_to_b) // aの半径rとbの半径rの和が2つの円の距離未満である場合
{
return FALSE;
} else if ((ar + br) >= dis_a_to_b) {
return CROSS;
} else {
return OTHER;
}
}
void func_output(int result) {
printf("%d\n", result);
// printf("result = %d ", result);
/*
switch(result)
{
case -2:
printf("%d\n", result);
break;
case 0:
printf("%d\n", result);
break;
case 1:
printf("%d\n", result);
break;
case 2:
printf("%d\n", result);
break;
}
*/
}
|
#include <math.h>
#include <stdio.h>
#define FALSE 0
#define CROSS 1
#define A_IN_B -2
#define B_IN_A 2
#define OTHER -10
#define compile 0
struct circle {
double x; //中心のx座標
double y; //中心のy座標
double r; //円の半径
};
int func_judge(double ax, double ay, double ar, double bx, double by,
double br);
void func_output(int result);
main() {
int n = 0, i = 0; //データセット代入変数, 制御変数
int result = OTHER; //-2,0,1,2以外なら何でも良い
scanf("%d", &n);
for (i = 0; i < n; i++) {
struct circle a = {0, 0, 0}; //構造体変数の宣言(円a)
struct circle b = {0, 0, 0}; //構造体変数の宣言(円b)
scanf("%lf %lf %lf %lf %lf %lf", &a.x, &a.y, &a.r, &b.x, &b.y, &b.r); //入力
result = func_judge(a.x, a.y, a.r, b.x, b.y, b.r); //結果の計算
func_output(result);
result = OTHER;
}
return 0;
}
int func_judge(double ax, double ay, double ar, double bx, double by,
double br) {
double dis_a_to_b = 0; //円aと円bの距離を代入する変数
dis_a_to_b = sqrt(pow(ax - bx, 2) + pow(ay - by, 2)); //中心間の距離を計算
#if compile == 2
printf("dis_a_to_b = %lf ar = %lf br = %lf\n", dis_a_to_b, ar, br);
#endif
if (ar >
(br +
dis_a_to_b)) // aの半径rがbの半径rと円aと円bの中心座標の距離の和よりも大きい場合
{
return B_IN_A;
} else if (
br >
(ar +
dis_a_to_b)) // bの半径rがaの半径rと円aと円bの中心座標の距離の和よりも大きい場合
{
return A_IN_B;
} else if ((ar + br) <
dis_a_to_b) // aの半径rとbの半径rの和が2つの円の距離未満である場合
{
return FALSE;
} else if ((ar + br) >= dis_a_to_b) {
return CROSS;
} else {
return OTHER;
}
}
void func_output(int result) {
printf("%d\n", result);
// printf("result = %d ", result);
/*
switch(result)
{
case -2:
printf("%d\n", result);
break;
case 0:
printf("%d\n", result);
break;
case 1:
printf("%d\n", result);
break;
case 2:
printf("%d\n", result);
break;
}
*/
}
|
[["-", 0, 11, 12, 2, 3, 4, 0, 118, 119, 120], ["+", 0, 11, 12, 2, 3, 4, 0, 118, 119, 120]]
| 0
| 386
|
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
using namespace std;
double dis(long double x1, long double y1, long double x2, long double y2);
int main() {
long double x1, y1, r1;
long double x2, y2, r2;
long double ans;
double r[2];
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x1 >> y1 >> r1;
cin >> x2 >> y2 >> r2;
ans = dis(x1, y1, x2, y2);
if (ans > r1 + r2) {
cout << "0" << endl;
} else if (ans <= r1 + r2) {
if (r2 > ans + r1) {
cout << "-2" << endl;
continue;
} else if (r1 > ans + r2) {
cout << "2" << endl;
continue;
}
cout << "-1" << endl;
}
}
}
double dis(long double x1, long double y1, long double x2, long double y2) {
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
|
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
using namespace std;
double dis(long double x1, long double y1, long double x2, long double y2);
int main() {
long double x1, y1, r1;
long double x2, y2, r2;
long double ans;
double r[2];
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x1 >> y1 >> r1;
cin >> x2 >> y2 >> r2;
ans = dis(x1, y1, x2, y2);
if (ans > r1 + r2) {
cout << "0" << endl;
} else if (ans <= r1 + r2) {
if (r2 > ans + r1) {
cout << "-2" << endl;
continue;
} else if (r1 > ans + r2) {
cout << "2" << endl;
continue;
}
cout << "1" << endl;
}
}
}
double dis(long double x1, long double y1, long double x2, long double y2) {
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
|
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
| 1
| 243
|
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
double xa, ya, ra, xb, yb, rb, l;
cin >> xa >> ya >> ra >> xb >> yb >> rb;
l = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
if (l > ra + rb)
cout << 0 << endl;
else if (ra > l + rb)
cout << 2 << endl;
else if (rb < l + ra)
cout << -2 << endl;
else
cout << 1 << endl;
}
return 0;
}
|
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
double xa, ya, ra, xb, yb, rb, l;
cin >> xa >> ya >> ra >> xb >> yb >> rb;
l = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
if (l > ra + rb)
cout << 0 << endl;
else if (ra > l + rb)
cout << 2 << endl;
else if (rb > l + ra)
cout << -2 << endl;
else
cout << 1 << endl;
}
return 0;
}
|
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47]]
| 1
| 147
|
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, c) \
for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RFOR(i, c) \
for (__typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a, b) make_pair(a, b)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &t) {
os << "[";
FOR(it, t) {
if (it != t.begin())
os << ",";
os << *it;
}
os << "]";
return os;
}
template <class T> ostream &operator<<(ostream &os, const set<T> &t) {
os << "{";
FOR(it, t) {
if (it != t.begin())
os << ",";
os << *it;
}
os << "}";
return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
return os << "(" << t.first << "," << t.second << ")";
}
template <class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
return pair<S, T>(s.first + t.first, s.second + t.second);
}
template <class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
return pair<S, T>(s.first - t.first, s.second - t.second);
}
const int INF = 1 << 28;
const double EPS = 1e-8;
const int MOD = 1000000007;
namespace geom {
#define X real()
#define Y imag()
typedef double R;
typedef complex<R> P;
istream &operator>>(istream &is, P &p) {
double x, y;
is >> x >> y;
p = P(x, y);
return is;
}
struct L : public vector<P> {
L(const P &p1, const P &p2) {
this->push_back(p1);
this->push_back(p2);
}
friend istream &operator>>(istream &is, L &l) {
P p1, p2;
is >> p1 >> p2;
l = L(p1, p2);
return is;
}
};
inline int sig(double x) { return (abs(x) < EPS ? 0 : x > 0 ? 1 : -1); }
inline R norm(const P &p) { return p.X * p.X + p.Y * p.Y; }
inline R inp(const P &a, const P &b) { return (conj(a) * b).X; }
inline R outp(const P &a, const P &b) { return (conj(a) * b).Y; }
inline P unit(const P &p) { return p / abs(p); }
inline P proj(const P &s, const P &t) { return t * inp(s, t) / norm(t); }
inline P proj(const P &s, const L &t) {
return t[0] + proj(s - t[0], t[1] - t[0]);
}
inline bool sp_intersect(const L &s, const P &p) {
return !sig(abs(s[0] - p) + abs(s[1] - p) - abs(s[0] - s[1]));
}
struct C : public P {
double r;
friend istream &operator>>(istream &is, C &c) {
operator>>(is, (P &)c);
is >> c.r;
return is;
}
};
struct G : public vector<P> {
enum { OUT, IN, ON };
P &at(int i) { return (*this)[i]; }
bool contains(const P &p) {
R sum = .0;
REP(i, size()) {
if (sp_intersect(L(at(i), at((i + 1) % size())), p))
return ON; // online
sum += arg((at(i) - p) / (at((i + 1) % size()) - p));
}
return sig(sum) ? IN : OUT;
}
R area() {
R sum = 0;
REP(i, size()) sum += outp(at(i), at((i + 1) % size()));
return abs(sum / 2.);
}
};
}; // namespace geom
using namespace geom;
int n;
int main() {
ios::sync_with_stdio(false);
int T;
cin >> T;
REP(t, T) {
C a, b;
cin >> a >> b;
int ans;
if (abs(a - b) > a.r + a.r)
ans = 0;
else if (abs(a - b) + b.r < a.r)
ans = 2;
else if (abs(a - b) + a.r < b.r)
ans = -2;
else
ans = 1;
cout << ans << endl;
}
return 0;
}
|
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, c) \
for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RFOR(i, c) \
for (__typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a, b) make_pair(a, b)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &t) {
os << "[";
FOR(it, t) {
if (it != t.begin())
os << ",";
os << *it;
}
os << "]";
return os;
}
template <class T> ostream &operator<<(ostream &os, const set<T> &t) {
os << "{";
FOR(it, t) {
if (it != t.begin())
os << ",";
os << *it;
}
os << "}";
return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
return os << "(" << t.first << "," << t.second << ")";
}
template <class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
return pair<S, T>(s.first + t.first, s.second + t.second);
}
template <class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
return pair<S, T>(s.first - t.first, s.second - t.second);
}
const int INF = 1 << 28;
const double EPS = 1e-8;
const int MOD = 1000000007;
namespace geom {
#define X real()
#define Y imag()
typedef double R;
typedef complex<R> P;
istream &operator>>(istream &is, P &p) {
double x, y;
is >> x >> y;
p = P(x, y);
return is;
}
struct L : public vector<P> {
L(const P &p1, const P &p2) {
this->push_back(p1);
this->push_back(p2);
}
friend istream &operator>>(istream &is, L &l) {
P p1, p2;
is >> p1 >> p2;
l = L(p1, p2);
return is;
}
};
inline int sig(double x) { return (abs(x) < EPS ? 0 : x > 0 ? 1 : -1); }
inline R norm(const P &p) { return p.X * p.X + p.Y * p.Y; }
inline R inp(const P &a, const P &b) { return (conj(a) * b).X; }
inline R outp(const P &a, const P &b) { return (conj(a) * b).Y; }
inline P unit(const P &p) { return p / abs(p); }
inline P proj(const P &s, const P &t) { return t * inp(s, t) / norm(t); }
inline P proj(const P &s, const L &t) {
return t[0] + proj(s - t[0], t[1] - t[0]);
}
inline bool sp_intersect(const L &s, const P &p) {
return !sig(abs(s[0] - p) + abs(s[1] - p) - abs(s[0] - s[1]));
}
struct C : public P {
double r;
friend istream &operator>>(istream &is, C &c) {
operator>>(is, (P &)c);
is >> c.r;
return is;
}
};
struct G : public vector<P> {
enum { OUT, IN, ON };
P &at(int i) { return (*this)[i]; }
bool contains(const P &p) {
R sum = .0;
REP(i, size()) {
if (sp_intersect(L(at(i), at((i + 1) % size())), p))
return ON; // online
sum += arg((at(i) - p) / (at((i + 1) % size()) - p));
}
return sig(sum) ? IN : OUT;
}
R area() {
R sum = 0;
REP(i, size()) sum += outp(at(i), at((i + 1) % size()));
return abs(sum / 2.);
}
};
}; // namespace geom
using namespace geom;
int n;
int main() {
ios::sync_with_stdio(false);
int T;
cin >> T;
REP(t, T) {
C a, b;
cin >> a >> b;
int ans;
if (abs(a - b) > a.r + b.r)
ans = 0;
else if (abs(a - b) + b.r < a.r)
ans = 2;
else if (abs(a - b) + a.r < b.r)
ans = -2;
else
ans = 1;
cout << ans << endl;
}
return 0;
}
|
[["-", 15, 339, 51, 16, 12, 16, 12, 118, 28, 22], ["+", 15, 339, 51, 16, 12, 16, 12, 118, 28, 22]]
| 1
| 1,331
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
double xa, ya, ra, xb, yb, rb;
cin >> xa >> ya >> ra >> xb >> yb >> rb;
double dis = sqrt(pow((xa - xb), 2) - pow((ya - yb), 2));
if (fabs(ra - rb) >= dis)
if (ra > rb)
cout << "2" << endl;
else
cout << "-2" << endl;
else if (fabs(ra - rb) < dis && ra + rb > dis)
cout << "1" << endl;
else
cout << "0" << endl;
}
}
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
double xa, ya, ra, xb, yb, rb;
cin >> xa >> ya >> ra >> xb >> yb >> rb;
double dis = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
if (fabs(ra - rb) > dis)
if (ra > rb)
cout << "2" << endl;
else
cout << "-2" << endl;
else if (fabs(ra - rb) <= dis && ra + rb >= dis)
cout << "1" << endl;
else
cout << "0" << endl;
}
}
|
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20]]
| 1
| 161
|
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
#define rrep(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define erep(i, m, n) for (int(i) = (m); (i) <= (n); (i)++)
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrev(i, m, n) for (int(i) = (n)-1; (i) >= (m); (i)--)
#define erev(i, m, n) for (int(i) = (n); (i) >= (m); (i)--)
#define rev(i, n) for (int(i) = (n)-1; (i) >= 0; (i)--)
#define vrep(i, c) \
for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ALL(v) (v).begin(), (v).end()
#define mp make_pair
#define pb push_back
template <class T, class S> inline bool minup(T &m, S x) {
return m > (T)x ? (m = (T)x, true) : false;
}
template <class T, class S> inline bool maxup(T &m, S x) {
return m < (T)x ? (m = (T)x, true) : false;
}
const int INF = 1000000000;
const ll MOD = 1000000007LL;
const double EPS = 1E-12;
template <typename T> T add(T x, T y) {
if (abs(x + y) < EPS * (abs(x) + abs(y)))
return 0;
return x + y;
}
template <typename T> inline bool semieq(T x, T y) { return abs(x - y) < EPS; }
template <typename T> inline bool semige(T x, T y) { return y - x < -EPS; }
template <typename T> inline bool semile(T x, T y) { return x - y < -EPS; }
struct Point : public complex<double> {
public:
Point() {
this->real(0);
this->imag(0);
}
Point(const double &x, const double &y) {
this->real(x);
this->imag(y);
}
Point(const complex<double> w) {
this->real(w.real());
this->imag(w.imag());
}
inline double dot(Point p) { return (conj(*this) * p).real(); } // ??????
inline double det(Point p) { return (conj(*this) * p).imag(); } // ??????
};
namespace std {
bool operator<(const Point &a, const Point &b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
} // namespace std
typedef vector<Point> Polygon;
#define currPoint(P, i) P[i]
#define nextPoint(P, i) P[(i + 1) % P.size()]
struct Circle : Point {
private:
Point p;
double r;
public:
Circle(Point &p, double r) : p(p), r(r) {}
Circle(double x, double y, double r) : p(Point(x, y)), r(r) {}
inline Point center() { return this->p; }
inline double radius() { return this->r; }
};
int circlesIntersection(Circle &A, Circle &B) {
double d = abs(A.center() - B.center());
if (semile(d, A.radius() - B.radius()))
return 1; // B in A
if (semile(d, B.radius() - A.radius()))
return -1; // A in B
if (semieq(d, A.radius() - B.radius()))
return 2; // B in A????????\???
if (semieq(d, B.radius() - A.radius()))
return -2; // A in B????????\???
if (semige(d, A.radius() + B.radius()))
return 3; // ???????????????
if (semieq(d, A.radius() + B.radius()))
return -3; // ?????\
return 4; // ????????£?????????
}
int n;
double x, y, r;
Point N(0.0, 0.0);
int main() {
cin >> n;
while (n--) {
cin >> x >> y >> r;
Circle A(x, y, r);
cin >> x >> y >> r;
Circle B(x, y, r);
int res = circlesIntersection(A, B);
if (res == 1) {
puts("2");
continue;
}
if (res == -1) {
puts("-2");
continue;
}
if (res == 3) {
puts("0");
continue;
}
puts("0");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
#define rrep(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define erep(i, m, n) for (int(i) = (m); (i) <= (n); (i)++)
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrev(i, m, n) for (int(i) = (n)-1; (i) >= (m); (i)--)
#define erev(i, m, n) for (int(i) = (n); (i) >= (m); (i)--)
#define rev(i, n) for (int(i) = (n)-1; (i) >= 0; (i)--)
#define vrep(i, c) \
for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ALL(v) (v).begin(), (v).end()
#define mp make_pair
#define pb push_back
template <class T, class S> inline bool minup(T &m, S x) {
return m > (T)x ? (m = (T)x, true) : false;
}
template <class T, class S> inline bool maxup(T &m, S x) {
return m < (T)x ? (m = (T)x, true) : false;
}
const int INF = 1000000000;
const ll MOD = 1000000007LL;
const double EPS = 1E-12;
template <typename T> T add(T x, T y) {
if (abs(x + y) < EPS * (abs(x) + abs(y)))
return 0;
return x + y;
}
template <typename T> inline bool semieq(T x, T y) { return abs(x - y) < EPS; }
template <typename T> inline bool semige(T x, T y) { return y - x < -EPS; }
template <typename T> inline bool semile(T x, T y) { return x - y < -EPS; }
struct Point : public complex<double> {
public:
Point() {
this->real(0);
this->imag(0);
}
Point(const double &x, const double &y) {
this->real(x);
this->imag(y);
}
Point(const complex<double> w) {
this->real(w.real());
this->imag(w.imag());
}
inline double dot(Point p) { return (conj(*this) * p).real(); } // ??????
inline double det(Point p) { return (conj(*this) * p).imag(); } // ??????
};
namespace std {
bool operator<(const Point &a, const Point &b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
} // namespace std
typedef vector<Point> Polygon;
#define currPoint(P, i) P[i]
#define nextPoint(P, i) P[(i + 1) % P.size()]
struct Circle : Point {
private:
Point p;
double r;
public:
Circle(Point &p, double r) : p(p), r(r) {}
Circle(double x, double y, double r) : p(Point(x, y)), r(r) {}
inline Point center() { return this->p; }
inline double radius() { return this->r; }
};
int circlesIntersection(Circle &A, Circle &B) {
double d = abs(A.center() - B.center());
if (semile(d, A.radius() - B.radius()))
return 1; // B in A
if (semile(d, B.radius() - A.radius()))
return -1; // A in B
if (semieq(d, A.radius() - B.radius()))
return 2; // B in A????????\???
if (semieq(d, B.radius() - A.radius()))
return -2; // A in B????????\???
if (semige(d, A.radius() + B.radius()))
return 3; // ???????????????
if (semieq(d, A.radius() + B.radius()))
return -3; // ?????\
return 4; // ????????£?????????
}
int n;
double x, y, r;
Point N(0.0, 0.0);
int main() {
cin >> n;
while (n--) {
cin >> x >> y >> r;
Circle A(x, y, r);
cin >> x >> y >> r;
Circle B(x, y, r);
int res = circlesIntersection(A, B);
if (res == 1) {
puts("2");
continue;
}
if (res == -1) {
puts("-2");
continue;
}
if (res == 3) {
puts("0");
continue;
}
puts("1");
}
return 0;
}
|
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
| 1
| 962
|
#include <array>
#include <iostream>
#include <math.h>
int main() {
std::array<double, 3> a; // 0:xa 1:ya 2:ra
std::array<double, 3> b;
int N;
std::cin >> N;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < 3; ++j)
std::cin >> a[j];
for (int j = 0; j < 3; ++j)
std::cin >> b[j];
double ab = sqrt((a[0] * b[0]) + (a[1] * b[1]));
if (ab > (a[2] + b[2]))
std::cout << 0 << std::endl;
else if (a[2] > ab + b[2])
std::cout << 2 << std::endl;
else if (b[2] > ab + a[2])
std::cout << -2 << std::endl;
else
std::cout << 1 << std::endl;
}
return 0;
}
|
#include <array>
#include <iostream>
#include <math.h>
int main() {
std::array<double, 3> a; // 0:xa 1:ya 2:ra
std::array<double, 3> b;
int N;
std::cin >> N;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < 3; ++j)
std::cin >> a[j];
for (int j = 0; j < 3; ++j)
std::cin >> b[j];
double ab = hypot((a[0] - b[0]), (a[1] - b[1]));
if (ab > (a[2] + b[2]))
std::cout << 0 << std::endl;
else if (a[2] > ab + b[2])
std::cout << 2 << std::endl;
else if (b[2] > ab + a[2])
std::cout << -2 << std::endl;
else
std::cout << 1 << std::endl;
}
return 0;
}
|
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 17, 48], ["+", 51, 2, 3, 4, 0, 23, 0, 16, 17, 33], ["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 17, 48]]
| 1
| 224
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
double xa, ya, ra, xb, yb, rb;
double ab;
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> xa >> ya >> ra >> xb >> yb >> rb;
ab = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
if (ra - ab > rb)
cout << 2 << endl;
else if (rb - ab > ra)
cout << -2 << endl;
else if (ab > ra + ra)
cout << 0 << endl;
else
cout << 1 << endl;
}
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
double xa, ya, ra, xb, yb, rb;
double ab;
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> xa >> ya >> ra >> xb >> yb >> rb;
ab = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
if (ra - ab > rb)
cout << 2 << endl;
else if (rb - ab > ra)
cout << -2 << endl;
else if (ab > (ra + rb))
cout << 0 << endl;
else
cout << 1 << endl;
}
return 0;
}
|
[["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25]]
| 1
| 162
|
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
double xa, ya, ra, xb, yb, rb;
cin >> xa >> ya >> ra >> xb >> yb >> rb;
double dist = sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya));
int ans;
if (ra > dist + rb)
ans = 2;
else if (rb > dist + ra)
ans = -2;
else if (ra + rb < dist)
ans = 0;
else
ans = -1;
cout << ans << endl;
}
}
|
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
double xa, ya, ra, xb, yb, rb;
cin >> xa >> ya >> ra >> xb >> yb >> rb;
double dist = sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya));
int ans;
if (ra > dist + rb)
ans = 2;
else if (rb > dist + ra)
ans = -2;
else if (ra + rb < dist)
ans = 0;
else
ans = 1;
cout << ans << endl;
}
}
|
[["-", 0, 57, 75, 76, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 13]]
| 1
| 139
|
#include <cmath>
#include <iostream>
using namespace std;
struct Circle {
long double x, y, r;
};
int solve(Circle c, Circle d) {
long double dist = (c.x - d.x) * (c.x - d.x) + (c.y - d.y) * (c.y - d.y);
dist = sqrt(dist);
long double dist2 = d.r + dist;
if (dist2 < c.r) {
return 2;
}
long double dist3 = c.r + dist;
if (dist3 < d.r) {
return -2;
}
long double dist4 = c.r + d.r;
if (dist4 < dist) {
return 0;
}
return 1;
}
int main() {
Circle a, b;
int n;
for (int i = 0; i < n; i++) {
cin >> a.x >> a.y >> a.r >> b.x >> b.y >> b.r;
cout << solve(a, b) << endl;
}
return 0;
}
|
#include <cmath>
#include <iostream>
using namespace std;
struct Circle {
long double x, y, r;
};
int solve(Circle c, Circle d) {
long double dist = (c.x - d.x) * (c.x - d.x) + (c.y - d.y) * (c.y - d.y);
dist = sqrt(dist);
long double dist2 = d.r + dist;
if (dist2 < c.r) {
return 2;
}
long double dist3 = c.r + dist;
if (dist3 < d.r) {
return -2;
}
long double dist4 = c.r + d.r;
if (dist4 < dist) {
return 0;
}
return 1;
}
int main() {
Circle a, b;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a.x >> a.y >> a.r >> b.x >> b.y >> b.r;
cout << solve(a, b) << endl;
}
return 0;
}
|
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
| 1
| 225
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n, ans;
float x1, y1, r1, x2, y2, r2, dis;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
dis = hypot(x2 - x1, y2 - y1);
ans = 0;
if (dis < r2 - r1) {
ans = 2;
} else if (dis < r1 - r2) {
ans = -2;
} else if (r1 + r2 >= dis) {
ans = 1;
}
cout << ans << endl;
}
return 0;
}
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n, ans;
double x1, y1, r1, x2, y2, r2, dis;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
dis = hypot(x2 - x1, y2 - y1);
ans = 0;
if (dis < r1 - r2) {
ans = 2;
} else if (dis < r2 - r1) {
ans = -2;
} else if (r1 + r2 >= dis) {
ans = 1;
}
cout << ans << endl;
}
return 0;
}
|
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
| 1
| 138
|
#include <bits/stdc++.h>
using namespace std;
using db = double;
const db eps = 1e-12;
int sgn(db a, db b = 0) {
a -= b;
return (a > eps) - (a < -eps);
}
struct poi {
db x, y;
void r() { cin >> x >> y; }
poi operator-(poi p) { return {x - p.x, y - p.y}; }
db len() { return sqrt(x * x + y * y); }
};
int main() {
ios ::sync_with_stdio(false);
int t;
cin >> t;
while (t--) {
poi a, b;
db ra, rb;
a.r();
cin >> ra;
b.r();
cin >> rb;
db d = (b - a).len();
if (sgn(d, ra + rb) == 0 || sgn(d, abs(ra - rb)) == 0)
cout << "1\n";
else if (sgn(ra + d, rb) < 0)
cout << "-2\n";
else if (sgn(rb + d, ra) < 0)
cout << "2\n";
else
cout << "0\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using db = double;
const db eps = 1e-12;
int sgn(db a, db b = 0) {
a -= b;
return (a > eps) - (a < -eps);
}
struct poi {
db x, y;
void r() { cin >> x >> y; }
poi operator-(poi p) { return {x - p.x, y - p.y}; }
db len() { return sqrt(x * x + y * y); }
};
int main() {
ios ::sync_with_stdio(false);
int t;
cin >> t;
while (t--) {
poi a, b;
db ra, rb;
a.r();
cin >> ra;
b.r();
cin >> rb;
db d = (b - a).len();
if (sgn(d, ra + rb) <= 0 && sgn(d, abs(ra - rb)) >= 0)
cout << "1\n";
else if (sgn(ra + d, rb) < 0)
cout << "-2\n";
else if (sgn(rb + d, ra) < 0)
cout << "2\n";
else
cout << "0\n";
}
return 0;
}
|
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20]]
| 1
| 269
|
#include <cmath>
#include <iostream>
using namespace std;
int check(double xa, double ya, double ra, double xb, double yb, double rb) {
double dist = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
double minr = min(ra, rb);
if (ra + rb < dist) {
return 0;
} else {
if (ra > rb && dist < rb) {
return 2;
} else if (ra < rb && dist < ra) {
return -2;
} else {
return 1;
}
}
}
int main() {
int N;
cin >> N;
for (int i = 0; i < N; ++i) {
double xa, ya, ra, xb, yb, rb;
cin >> xa >> ya >> ra >> xb >> yb >> rb;
cout << check(xa, ya, ra, xb, yb, rb) << endl;
}
}
|
#include <cmath>
#include <iostream>
using namespace std;
int check(double xa, double ya, double ra, double xb, double yb, double rb) {
double dist = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
double minr = min(ra, rb);
if (ra + rb < dist) {
return 0;
} else {
if (ra > rb && dist < ra - rb) {
return 2;
} else if (ra < rb && dist < rb - ra) {
return -2;
} else {
return 1;
}
}
}
int main() {
int N;
cin >> N;
for (int i = 0; i < N; ++i) {
double xa, ya, ra, xb, yb, rb;
cin >> xa >> ya >> ra >> xb >> yb >> rb;
cout << check(xa, ya, ra, xb, yb, rb) << endl;
}
}
|
[["+", 15, 339, 51, 16, 12, 16, 12, 16, 31, 22], ["+", 15, 339, 51, 16, 12, 16, 12, 16, 17, 33]]
| 1
| 199
|
#include <cmath>
#include <iostream>
int main() {
int n;
std::cin >> n;
for (int i = 0; i < n; i++) {
long double xa, ya, ra, xb, yb, rb;
std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
long double d = hypot(xa - xb, ya - yb);
if (d < abs(ra - rb)) {
std::cout << 2 * (ra < rb ? -1 : 1) << std::endl;
} else if (d <= ra + rb) {
std::cout << 1 << std::endl;
} else {
std::cout << 0 << std::endl;
}
}
return 0;
}
|
#include <cmath>
#include <iostream>
int main() {
int n;
std::cin >> n;
for (int i = 0; i < n; i++) {
long double xa, ya, ra, xb, yb, rb;
std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
long double d = hypot(xa - xb, ya - yb);
if (d < std::abs(ra - rb)) {
std::cout << 2 * (ra < rb ? -1 : 1) << std::endl;
} else if (d <= ra + rb) {
std::cout << 1 << std::endl;
} else {
std::cout << 0 << std::endl;
}
}
return 0;
}
|
[["+", 15, 339, 51, 16, 12, 2, 63, 343, 345, 348], ["+", 15, 339, 51, 16, 12, 2, 63, 343, 0, 349]]
| 1
| 150
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
double xa, ya, ra, xb, yb, rb;
cin >> xa >> ya >> ra >> xb >> yb >> rb;
double d = hypot(xa - xb, yb - yb);
int res = 1;
if (ra > rb) {
if (d <= ra - rb)
res = 2;
else if (d > ra + rb)
res = 0;
} else {
if (d <= rb - ra)
res = -2;
else if (d > ra + rb)
res = 0;
}
cout << res << endl;
}
return 0;
}
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
double xa, ya, ra, xb, yb, rb;
cin >> xa >> ya >> ra >> xb >> yb >> rb;
double d = hypot(xa - xb, ya - yb);
int res = 1;
if (ra > rb) {
if (d < ra - rb)
res = 2;
else if (d > ra + rb)
res = 0;
} else {
if (d < rb - ra)
res = -2;
else if (d > ra + rb)
res = 0;
}
cout << res << endl;
}
return 0;
}
|
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
| 1
| 144
|
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double x1, x2, y1, y2, r1, r2, d;
int n, i;
cin >> n;
for (i = 0; i < n; i++) {
cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
d = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
if (d - r1 - r2 > 0.0)
cout << "0" << endl;
else if (r1 - d - r2 > 0.0)
cout << "2" << endl;
else if (r2 - d - r1 < 0.0)
cout << "-2" << endl;
else
cout << "1" << endl;
}
}
|
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double x1, x2, y1, y2, r1, r2, d;
int n, i;
cin >> n;
for (i = 0; i < n; i++) {
cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
d = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
if (d - r1 - r2 > 0.0)
cout << "0" << endl;
else if (r1 - d - r2 > 0.0)
cout << "2" << endl;
else if (r2 - d - r1 > 0.0)
cout << "-2" << endl;
else
cout << "1" << endl;
}
}
|
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47]]
| 1
| 161
|
#include <cmath>
#include <iostream>
enum JudgeCircleIntersect {
BinA = 2,
AinB = -2,
AcrossB = 1,
AdisB = 0,
Error = -1
};
struct Circle {
Circle() {}
Circle(double sx, double sy, double sr) : cx(sx), cy(sy), r(sr) {}
double cx;
double cy;
double r;
};
double Abs(double x) { return x >= 0 ? x : -x; }
JudgeCircleIntersect Intersect(const Circle &a, const Circle &b) {
double distance =
sqrt((a.cx - b.cx) * (a.cx - b.cx) + (a.cy - b.cy) * (a.cy - b.cy));
if (a.r + b.r < distance) {
return AdisB;
} else if ((b.r - a.r) > distance && (b.r - a.r) > 0) {
return AinB;
} else if ((a.r - b.r) > distance && (a.r - b.r) > 0) {
return BinA;
} else if (Abs(a.r - b.r) == distance || (a.r + b.r == distance)) {
return AcrossB;
} else {
return Error;
}
}
int main() {
int n = 0;
double xa, ya, ra, xb, yb, rb;
std::cin >> n;
for (int i = 0; i < n; ++i) {
std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
Circle a(xa, ya, ra);
Circle b(xb, yb, rb);
std::cout << Intersect(a, b) << '\n';
}
}
|
#include <cmath>
#include <iostream>
enum JudgeCircleIntersect {
BinA = 2,
AinB = -2,
AcrossB = 1,
AdisB = 0,
Error = -1
};
struct Circle {
Circle() {}
Circle(double sx, double sy, double sr) : cx(sx), cy(sy), r(sr) {}
double cx;
double cy;
double r;
};
double Abs(double x) { return x >= 0 ? x : -x; }
JudgeCircleIntersect Intersect(const Circle &a, const Circle &b) {
double distance =
sqrt((a.cx - b.cx) * (a.cx - b.cx) + (a.cy - b.cy) * (a.cy - b.cy));
if (a.r + b.r < distance) {
return AdisB;
} else if ((b.r - a.r) > distance && (b.r - a.r) > 0) {
return AinB;
} else if ((a.r - b.r) > distance && (a.r - b.r) > 0) {
return BinA;
} else if (Abs(a.r - b.r) <= distance && (a.r + b.r >= distance)) {
return AcrossB;
} else {
return Error;
}
}
int main() {
int n = 0;
double xa, ya, ra, xb, yb, rb;
std::cin >> n;
for (int i = 0; i < n; ++i) {
std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
Circle a(xa, ya, ra);
Circle b(xb, yb, rb);
std::cout << Intersect(a, b) << '\n';
}
/*
Circle a(20.0,40.0,30.0); // 位置(20,40), 半径 30 の円
Circle b(30.0,50.0,20.0); // 位置(40,50), 半径 20 の円
if(Intersect(a,b))
{
std::cout << "a と b は交差している\n";
}
else
{
std::cout << "a と b は交差していない\n";
}
*/
}
|
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 15, 339, 51, 16, 12, 23, 0, 16, 17, 60], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 20]]
| 1
| 371
|
#include <math.h>
#include <stdio.h>
int main() {
int n, x;
double xa, ya, ra, xb, yb, rb, d;
scanf("%d", &n);
for (x = 0; x < n; x++) {
scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
if (ra + rb < d) {
printf("0\n");
} else if (ra < rb && d < rb - ra) {
printf("-2\n");
} else if (rb < ra && d < ra - rb) {
printf("2\n");
} else {
printf("1\n");
}
return 0;
}
}
|
#include <math.h>
#include <stdio.h>
int main() {
int n, x;
double xa, ya, ra, xb, yb, rb, d;
scanf("%d", &n);
for (x = 0; x < n; x++) {
scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
if (ra + rb < d) {
printf("0\n");
} else if (ra < rb && d < rb - ra) {
printf("-2\n");
} else if (rb < ra && d < ra - rb) {
printf("2\n");
} else {
printf("1\n");
}
}
return 0;
}
|
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
| 1
| 187
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.