text
stringlengths 49
983k
|
|---|
#include <bits/stdc++.h>
using namespace std;
void fre() {
freopen("c://test//input.in", "r", stdin);
freopen("c://test//output.out", "w", stdout);
}
template <class T1, class T2>
inline void gmax(T1 &a, T2 b) {
if (b > a) a = b;
}
template <class T1, class T2>
inline void gmin(T1 &a, T2 b) {
if (b < a) a = b;
}
const int N = 0, M = 0, Z = 1e9 + 7, ms63 = 0x3f3f3f3f;
long long n;
int main() {
while (~scanf("%lld", &n)) {
n = (n % 360 + 360) % 360;
if (n >= 315 || n <= 45) {
puts("0");
continue;
}
int ans = 0;
while (n > 45) {
++ans;
n -= 90;
}
printf("%d\n", ans);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m = 0, a;
string s = "";
cin >> n;
n = (n % 360 + 360) % 360;
n = 360 - n;
a = min(n, 360 - n);
for (int i = 1; i < 6; i++) {
n += 90;
n = (n % 360 + 360) % 360;
if (min(n, 360 - n) < a) {
a = min(n, 360 - n);
m = i;
}
}
cout << m;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int angle;
cin >> angle;
angle = (angle % 360 + 360) % 360;
if (angle <= 45) {
cout << 0 << endl;
} else if (angle <= 135) {
cout << 1 << endl;
} else if (angle <= 225) {
cout << 2 << endl;
} else if (angle <= 314) {
cout << 3 << endl;
} else {
cout << 0 << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:100000000")
int ri() {
int x;
scanf("%d", &x);
return x;
}
int main() {
long long n;
cin >> n;
n *= -1LL;
n %= 360LL;
n += 360LL;
n %= 360LL;
int minval = min(abs(n % 360 - 360), n);
int cnt = 0;
for (int i = 1; i <= 4; i++) {
int val =
min(abs((n + (i)*90 + 360) % 360 - 360), (n + (i)*90 + 360) % 360);
if (val < minval) cnt = i, minval = val;
}
cout << cnt << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int dist(int a, int b) { return min(abs(a - b), 360 - abs(a - b)); }
long long d;
int main() {
scanf("%I64d", &d);
d = (d % 360 + 360) % 360;
int ans = 1000;
for (int i = 0; i < 4; i++) ans = min(ans, dist(d, 90 * i));
for (int i = 0; i < 4; i++) {
if (dist(d, 90 * i) == ans) {
printf("%d\n", i);
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
cin >> x;
x %= 360;
x += 360;
x %= 360;
int fin = 0, u = 0, mini = 2e9;
while (x && u < 100) {
if (mini > min(x, 360 - x)) {
mini = min(x, 360 - x);
fin = u;
}
x -= 90;
x += 360;
x %= 360;
u++;
}
cout << fin;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
const int64_t C = 360;
int64_t x;
std::cin >> x;
x %= C;
if (x < 0) {
x += C;
}
int ans(0), min(C + 1);
for (int p = 0; p < 5; p++) {
int64_t y = (C + x - 90 * p) % C;
if (y < min) {
min = y;
ans = p;
}
if ((C - y) < min) {
min = C - y;
ans = p;
}
}
ans %= 4;
std::cout << ans << std::endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n;
int c(long long x) { return min(x % 360, 360 - x % 360); }
int main() {
cin >> n;
if (n < 0) {
n = (-n) % 360;
} else {
n = 360 - n % 360;
}
int r = 0;
int m = c(n);
for (int i = 1; i <= 4; i++)
if (c(n + 90 * i) < m) {
r = i;
m = c(n + 90 * i);
}
cout << r;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int main() {
long long n;
cin >> n;
n %= 360;
int res = 1 << 30, t = 0;
for (int i = 0; i <= 20; ++i) {
int m = (n - 90 * i) % 360;
m = (m + 360) % 360;
int p = min(m, 360 - m);
if (p < res) {
res = p;
t = i;
}
}
cout << t << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1.01e9;
const double eps = 1e-9;
long long cnk(long long n, int k) {
long long res = 1;
for (int i = 0; (i) < (k); ++i) res = (res * (n - i)) / (i + 1);
return res;
}
int main() {
long long n;
cin >> n;
n = n % 360;
n += 360;
n %= 360;
if (n >= 360 - 45) n = 0;
long long res = (n - 45 + 89) / 90;
if (n == 4) n = 0;
cout << res;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int p(int a) {
a = a + 90;
if (a >= 360) a = a % 360;
if (abs(a) >= 180) {
if (a >= 0)
a = -(360 - (a));
else
a = (360 - abs(a));
}
return a;
}
int main() {
long long n;
cin >> n;
n = n % 360;
n = -n;
if (abs(n) >= 180) {
if (n >= 0)
n = -(360 - (n));
else
n = (360 - abs(n));
}
int a[5], index, minn = 10000000;
a[0] = n;
a[1] = p(n);
a[2] = p(a[1]);
a[3] = p(a[2]);
a[4] = p(a[3]);
for (int i = 0; i <= 4; i++) {
a[i] = abs(a[i]);
}
for (int i = 0; i <= 4; i++) {
if (a[i] < minn) {
minn = a[i];
index = i;
}
}
cout << index;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
cin >> x;
x %= 360;
if (x <= 45 && x >= -45) cout << 0;
if (x > 45 && x <= 135) cout << 1;
if (x > 135 && x <= 225) cout << 2;
if (x > 225 && x < 315) cout << 3;
if (x >= 315 && x < 360) cout << 0;
if (x < -45 && x > -135) cout << 3;
if (x <= -135 && x > -225) cout << 2;
if (x <= -225 && x > -315) cout << 1;
if (x <= -315) cout << 0;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
long long x;
scanf("%lld", &x);
x = ((x % 360) + 360) % 360;
if (x <= 45 || x >= 315)
printf("0");
else
printf("%d", (x - 46) / 90 + 1);
}
|
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f;
const double pi = acos(-1.0);
const double inf = 1e18;
const long long mod = 1e9 + 7;
const unsigned long long mx = 133333331;
inline void RI(int &x) {
char c;
while ((c = getchar()) < '0' || c > '9')
;
x = c - '0';
while ((c = getchar()) >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0';
}
long long labs(long long x) {
if (x < 0) return -x;
return x;
}
long long judge(long long x) {
x %= 360;
if (x >= 180)
x = x - 360;
else if (x <= -180)
x += 360;
return labs(x);
}
int main() {
long long x;
while (cin >> x) {
x %= 360;
long long ans = INF;
int f = 0;
for (int i = 0; i <= 4; i++) {
if (ans > judge(x - i * 90)) {
ans = judge(x - i * 90);
f = i;
}
}
cout << f << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const long long mod = 1e9 + 7;
const int maxn = 100005;
long long n;
long long d[10];
void solve() {
int i;
cin >> n;
n = (n % 360 + 360) % 360;
long long ans = 1000, res;
for (i = 0; i <= 4; i++) {
if (n < ans || 360 - n < ans) {
ans = min(n, 360 - n);
res = i;
}
n = (n + 270) % 360;
}
cout << res;
}
int main() {
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long a = 1e14;
long long n, ans;
int main() {
cin >> n;
while (n < 0) n += 360 * a;
n %= 360;
while (true) {
if (n <= 45 || n >= 315) {
cout << ans;
return 0;
}
ans++;
n -= 90;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int mod360(long long);
int turns(long long);
int main() {
long long a;
cin >> a;
cout << turns(mod360(a));
return 0;
}
int mod360(long long c) {
c %= 360;
return (c < 0 ? c + 360 : c);
}
int turns(long long c) {
if ((c >= 0 and c <= 45) or (c >= 315 and c <= 360))
return 0;
else if (c > 45 and c <= 135)
return 1;
else if (c > 135 and c <= 225)
return 2;
else if (c > 225 and c < 315)
return 3;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e8;
const double PI = 4 * atan(1);
set<char> vowel = {'A', 'O', 'Y', 'E', 'U', 'I', 'a', 'o', 'y', 'e', 'u', 'i'};
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, 1, -1, -1};
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
bool issquare(long long w) { return trunc(sqrt(w)) * trunc(sqrt(w)) == w; }
bool isprime(long long u) {
for (long long i = 2; i <= (int)sqrt(u); i++) {
if (u % i == 0) return 0;
}
return 1;
}
long long mod(long long to_mod) {
to_mod %= MOD;
while (to_mod < 0) to_mod += MOD;
return to_mod % MOD;
}
long long power(long long x, long long y) {
long long res = 1;
x = x;
while (y > 0) {
if (y & 1) res = (res * x);
y = y >> 1;
x = (x * x);
}
return res;
}
long long _sieve_size;
bitset<5000005> bs;
vector<long long> primes;
void sieve(long long upperbound) {
_sieve_size = upperbound + 1;
bs.set();
bs[0] = bs[1] = 0;
for (long long i = 2; i <= _sieve_size; i++)
if (bs[i]) {
for (long long j = i * i; j <= _sieve_size; j += i) bs[j] = 0;
primes.push_back(i);
}
}
long long n, m, k, a, l, r, b, t, ans = 0, res = 0, x, y, z, xmax, xmin;
vector<long long> vv, v;
double db;
vector<vector<long long> > vvv;
map<long long, vector<long long> > adj;
char c;
bool check = true;
map<long long, long long> maa, maaa;
string ch, ch1, ch2;
unordered_set<long long> ss;
int main() {
ios_base::sync_with_stdio(false);
cin >> n;
if (n < 0) {
n *= -1;
n %= 360;
} else {
n %= 360;
n *= -1;
}
if (abs(n) >= 180) {
if (n > 0)
n = -(360 - n);
else
n = 360 + n;
}
ans = 0;
res = 5000;
m = n;
for (int i = 0; i <= 4; i++) {
n = m + 90 * i;
if (abs(n) < res || abs(360 - n) < res) {
res = min(abs(n), abs(360 - n));
ans = i;
}
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long x;
long long n, f = 1;
int main() {
cin >> n;
if (n < 0) {
f = -1;
n = -n;
}
x = (n % 360) * f * (-1);
long long a0 = x, a1 = x + 90, a2 = x + 180, a3 = x + 270;
a0 = min(abs(a0), (360 + a0) % 360);
if (a0 > 180) a0 = 360 - a0;
a1 = min(abs(a1), (360 + a1) % 360);
if (a1 > 180) a1 = 360 - a1;
a2 = min(abs(a2), (360 + a2) % 360);
if (a2 > 180) a2 = 360 - a2;
a3 = min(abs(a3), (360 + a3) % 360);
if (a3 > 180) a3 = 360 - a3;
if (a0 <= a1 && a0 <= a2 && a0 <= a3) {
cout << 0 << endl;
return 0;
}
if (a1 <= a0 && a1 <= a2 && a1 <= a3) {
cout << 1 << endl;
return 0;
}
if (a2 <= a1 && a2 <= a0 && a2 <= a3) {
cout << 2 << endl;
return 0;
}
cout << 3 << endl;
return 0;
}
|
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
template <class T>
inline void gmax(T &a, T b) {
if (b > a) a = b;
}
template <class T>
inline void gmin(T &a, T b) {
if (b < a) a = b;
}
using namespace std;
const int N = 1e5 + 10, M = 2e6 + 10, Z = 1e9 + 7, maxint = 2147483647,
ms1 = 16843009, ms31 = 522133279, ms63 = 1061109567,
ms127 = 2139062143;
const double PI = acos(-1.0), eps = 1e-8;
void fre() {
freopen("/Users/luras/Desktop/in.txt", "r", stdin);
freopen("/Users/luras/Desktop/out.txt", "w", stdout);
}
const int INF = 1e9;
int casenum, casei;
long long n;
int main() {
while (~scanf("%lld", &n)) {
n %= 360;
if (n < 0) n += 360;
if (n <= 45 || n >= 315)
puts("0");
else if (n <= 135)
puts("1");
else if (n <= 225)
puts("2");
else if (n <= 315)
puts("3");
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
long long n;
scanf("%lld", &n);
n %= 360;
if (n < 0) n += 360;
if (n <= 45 || n >= 315)
printf("0");
else if (n <= 135)
printf("1");
else if (n <= 225)
printf("2");
else
printf("3");
printf("\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long x;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> x;
x = (x % 360 + 360) % 360;
if (x >= 315)
cout << 0 << endl;
else {
x = (x + 44) % 360;
x = (x % 359) / 90;
cout << x << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
inline namespace Infinity {
inline namespace IO {
const char CR = '\n';
const char SP = ' ';
inline void write(const int n) { printf("%d", n); }
inline void write(const unsigned n) { printf("%u", n); }
inline void write(const long long n) { cout << n; }
inline void write(const unsigned long long n) { cout << n; }
inline void writef(const double a, const int n = 15) { printf("%.*f", n, a); }
inline void writef(const long double a, const int n = 18) {
cout << setprecision(n) << fixed << a;
}
inline void write(const char c) { printf("%c", c); }
inline void write(const char s[]) { printf("%s", s); }
inline void write(const string &s) { cout << s; }
inline void write(const pair<int, int> &p) {
printf("%d %d", p.first, p.second);
}
template <class T>
inline void write(const T a) {
for (auto i : a) write(i), write(SP);
}
inline void writeln() { write(CR); }
template <typename T>
inline void writeln(const T &a) {
write(a);
write(CR);
}
inline void writefln(const double a, int n) {
printf("%.*f", n, a);
write(CR);
}
inline void writefln(const long double a, int n = 18) {
cout << setprecision(n) << fixed << a << endl;
}
inline void writesln(const int *a, const int l, const int r) {
for (int i = l; i <= r; i++) printf("%d ", a[i]);
writeln(CR);
}
template <class T>
inline void writelns(const T a) {
for (__typeof a.begin() i = a.begin(); i != a.end(); i++) writeln(*i);
}
template <typename T, typename... types>
inline void write(const T &a, const types &...args) {
write(a);
write(args...);
}
template <typename... types>
inline void writeln(const types &...args) {
write(args...);
write(CR);
}
inline void writelnYN(bool b) { writeln(b ? "YES" : "NO"); }
inline void writelnyn(bool b) { writeln(b ? "Yes" : "No"); }
inline int read(int &n) { return scanf("%d", &n); }
inline int read(long long &n) { return cin >> n ? 1 : -1; }
template <typename T, typename... types>
inline int read(T &n, types &...args) {
read(n);
return read(args...);
}
inline char getcc() {
char c;
do c = getchar();
while (c == ' ' || c == '\n');
return c;
}
inline int getint() {
int n;
read(n);
return n;
}
inline long long getll() {
long long n;
read(n);
return n;
}
inline double getdouble() {
double n;
scanf("%lf", &n);
return n;
}
inline vector<int> getints(int n) {
vector<int> v(n);
for (int i = 0; i < n; i++) v[i] = getint();
return v;
}
inline vector<pair<int, int>> getpairs(int n) {
vector<pair<int, int>> v(n);
for (int i = 0; i < n; i++) {
int a = getint(), b = getint();
v[i] = pair<int, int>(a, b);
}
return v;
}
inline void read(string &str, const unsigned size) {
char s[size];
scanf("%s", s);
str = string(s);
}
inline string getstr(const unsigned size = 1048576) {
string s;
read(s, size + 1);
return s;
}
inline string getln(const unsigned size = 1048576) {
char s[size + 1];
scanf("%[^n]", s);
return string(s);
}
} // namespace IO
inline namespace Functions {
inline int ctoi(const char c) { return c - '0'; }
inline char itoc(const int n) { return n + '0'; }
inline int dtoi(const double d) { return round(d); }
template <typename T>
inline bool in(T x, T l, T r) {
return l <= x && x <= r;
}
template <class T>
inline int size(const T &a) {
return a.size();
}
template <typename T1, typename T2>
inline pair<T1, T2> mp(const T1 &a, const T2 &b) {
return make_pair(a, b);
}
template <class T>
inline void sort(T &a) {
std::sort(a.begin(), a.end());
}
template <class T1, class T2>
inline void sort(T1 &a, T2 comp) {
std::sort(a.begin(), a.end(), comp);
}
template <class T1, typename T2>
inline int lbound(const T1 &a, const T2 k) {
return lower_bound(a.begin(), a.end(), k) - a.begin();
}
template <class T1, typename T2>
inline int ubound(const T1 &a, const T2 k) {
return upper_bound(a.begin(), a.end(), k) - a.begin();
}
template <class T1, class T2>
int count(T1 &a, T2 k) {
return ubound(a, k) - lbound(a, k);
}
template <class T1, class T2>
int find(T1 &a, T2 k) {
return count(a, k) ? lbound(a, k) : -1;
}
template <typename T>
inline void clear(T &a) {
memset(a, 0, sizeof a);
}
template <typename T>
T gcd(T a, T b) {
while (b) {
T t = a % b;
a = b;
b = t;
}
return a;
}
template <typename T>
T lcm(T a, T b) {
return a / gcd(a, b) * b;
}
long long qpow(long long a, long long b, long long c) {
return b ? qpow(a * a % c, b >> 1, c) * (b & 1 ? a : 1) % c : 1;
}
template <typename T>
T exGcd(T a, T b, T &x, T &y) {
T d = a;
if (b) {
d = exGcd(b, a % b, y, x);
y -= a / b * x;
} else {
x = 1;
y = 0;
}
return d;
}
template <typename T>
T mps(T l, T r, T k) {
return ((r - (r % k + k) % k) - (l + (k - l % k) % k)) / k + 1;
}
template <typename T>
T sgn(T a) {
return a == 0 ? 0 : a > 0 ? 1 : -1;
}
} // namespace Functions
} // namespace Infinity
long long dt(long long d) { return min(llabs(d), llabs(d - 360)); }
int main(int, char *[]) {
long long d = getll();
d = sgn(d) * (llabs(d) % 360);
if (d < 0) d += 360;
int k = 0;
for (int i = 0; i < 4; i++)
if (dt(d - 90 * i) < dt(d - 90 * k)) k = i;
writeln(k);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int res[4];
int main() {
long long x;
scanf("%I64d", &x);
x = -x;
x = (x % 360 + 360) % 360;
for (int i = 0; i <= 3; i++) {
res[i] = x;
x = (x + 90) % 360;
}
for (int i = 0; i < 4; i++) res[i] = min(res[i], 360 - res[i]);
int loc = 0;
for (int i = 0; i < 4; i++)
if (res[loc] > res[i]) loc = i;
printf("%d\n", loc);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void task();
int main() {
task();
return 0;
}
const int N = (int)2e5 + 10;
void task() {
long long int x;
cin >> x;
x = -x;
x %= 360;
int ans = 0;
while (abs(x) > 45 && abs(x) < 315) {
x = (x + 90) % 360;
(void(1));
;
++ans;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const long long M = 1000000007;
long long a;
int main() {
scanf("%I64d", &a);
a %= 360;
a += 360;
long long ans = 0, mx = -1;
for (int i = 0; i < 4; i++) {
if (mx < abs((a + i * 270) % 360 - 180)) {
mx = abs((a + i * 270) % 360 - 180);
ans = i;
}
}
printf("%I64d\n", ans);
}
|
#include <bits/stdc++.h>
using namespace std;
long long x;
int main() {
cin >> x;
int dir = -1;
if (x < 0) dir = 1;
x = abs(x);
x %= 360;
int thei, thev = 360;
for (int i = 0; i < 4; i++, x += dir * 90) {
int tx = x;
tx = abs(tx) % 360;
if (tx > 180) tx = 360 - tx;
if (thev > tx) thev = tx, thei = i;
}
printf("%d\n", thei);
return 0;
}
|
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7;
long long x;
int get(int x) { return min(x, 360 - x); }
int main() {
ios_base::sync_with_stdio(0);
scanf("%I64d", &x);
x = (x % 360 + 360) % 360;
int dif = get(x), ans = 0;
for (int i = 1; i < 4; ++i) {
int y = ((x - 90 * i) % 360 + 360) % 360;
y = get(y);
if (y < dif) ans = i, dif = y;
}
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
scanf("%I64d", &x);
x %= 360;
long long t = 360 - x;
t %= 360;
long long Min = 360;
int opt;
for (int i = 0; i <= 10; i++) {
if (min(t, 360 - t) < Min) {
Min = min(t, 360 - t);
opt = i;
}
t += 90;
t %= 360;
}
printf("%d", opt);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int g, i, res;
long long x;
cin >> x;
x = (-x) % 360;
while (x < 0) x += 360;
g = x;
res = 0;
for (i = 1; i <= 3; i++) {
g = (g + 90) % 360;
if (abs(180 - g) > abs(180 - x)) {
x = g;
res = i;
}
}
cout << res << endl;
}
|
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int main() {
long long x;
cin >> x;
if (x > 0)
x = (360 - x % 360);
else
x = (-x) % 360;
int m = 100000, ans = -1;
for (int i = 0; i < 4; i++) {
int tmp = (x + 90 * i) % 360;
if (tmp > 180) tmp = 360 - tmp;
if (tmp < m) {
m = tmp;
ans = i;
}
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7, Base = 998244353;
const long long N = 3e5 + 7;
const long long INF = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7LL;
const double pie = acos(-1.0);
long long angle, Ang = INF, op, x;
void Take_Min(long long angle, long long x) {
if (angle % 360 < Ang) Ang = angle % 360, op = x;
if (360 - angle < Ang) Ang = 360 - angle, op = x;
}
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> angle;
angle *= -1;
angle %= 360;
angle += 360;
angle %= 360;
Take_Min(angle, x);
angle = (angle + 90) % 360;
++x;
Take_Min(angle, x);
angle = (angle + 90) % 360;
++x;
Take_Min(angle, x);
angle = (angle + 90) % 360;
++x;
Take_Min(angle, x);
angle = (angle + 90) % 360;
++x;
Take_Min(angle, x);
cout << op << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long mod(long long a, long long b) {
long long ans = a % b;
if (ans < 0) ans += b;
if (ans > 180) ans = 360 - ans;
return ans;
}
int main() {
long long angle;
cin >> angle;
int ans, bestan = 361;
for (int i = 0; i < 4; i++) {
if (mod((i * 90 - angle), 360) < bestan) {
ans = i;
bestan = mod((i * 90 - angle), 360);
}
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
const int CONST = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int n;
cin >> n;
n = -(n % 360);
int ans = 360;
int tmp = 0;
int cnt = 0;
for (int i = 0; i <= 4; ++i) {
int newAng = abs((n + tmp) % 360);
newAng = min(newAng, 360 - newAng);
if (ans > newAng) {
ans = newAng;
cnt = i;
}
tmp += 90;
}
cout << cnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
scanf("%lld", &n);
n += 2 * (1000000000000000000LL) / 360 * 360;
n %= 360;
long long best = min(n, 360 - n);
int which = 0;
for (int i = 1; i < 4; i++) {
long long cur = (n + 270 * i) % 360;
if (min(cur, 360 - cur) < best) {
best = min(cur, 360 - cur);
which = i;
}
}
printf("%d\n", which);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long x;
cin >> x;
x = x - 360 * (x / 360);
if (x <= -180) {
x = 360 + x;
} else if (x > 180) {
x = x - 360;
}
if (x >= -45 && x <= 45) {
cout << 0;
} else if (x > 45 && x <= 135) {
cout << 1;
} else if (x > 135 && x <= 180 || x >= -180 && x <= -135) {
cout << 2;
} else {
cout << 3;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
long long n;
cin >> n;
n = (n % 360 + 360) % 360;
cout << (n + 44) % 360 % 359 / 90 << endl;
return 0;
}
|
#include <bits/stdc++.h>
typedef long long LL;
const double INF = 1e100;
const int oo = ~0u >> 2;
const double pi = acos(-1.0);
const double EPS = 1e-8;
const int MAXN = 100033;
LL n;
int main() {
std::cin >> n;
n = (n % 360 + 360) % 360;
n = (n + 44) % 360;
n = (n % 359) / 90;
std::cout << n;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x, a;
cin >> x;
a = (x % 360 + 360) % 360;
a = (a + 44) % 360;
a = (a % 359) / 90;
cout << a;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
long long n;
scanf("%lld", &n);
if (n < 0) {
n = -n;
n %= 360;
if (n <= 45)
printf("0");
else if (n <= 134)
printf("3");
else if (n <= 224)
printf("2");
else if (n <= 314)
printf("1");
else
printf("0");
} else {
n %= 360;
if (n <= 45)
printf("0");
else if (n <= 135)
printf("1");
else if (n <= 225)
printf("2");
else if (n <= 314)
printf("3");
else
printf("0");
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long int x;
cin >> x;
x += 90;
x %= 360;
if (x < 0) x += 360;
vector<pair<int, int> > v;
for (int i = 0; i < 5; i++) {
x %= 360;
if (x < 0) x += 360;
v.push_back(make_pair(abs(x - 90), i));
x -= 90;
}
sort(v.begin(), v.end());
cout << v[0].second << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a[360];
int c[360];
int main() {
long long n;
cin >> n;
n %= 360;
n *= -1;
if (n < 0) n = 360 + n;
int b = 0;
memset(a, -1, sizeof a);
memset(c, -1, sizeof c);
while (true) {
if (a[n] != -1) break;
a[n] = b;
c[360 - n] = b;
++b;
n += 90;
n %= 360;
}
for (int i = 0; i < 361; ++i) {
if (c[i] != -1 && a[i] != -1) {
cout << min(a[i], c[i]);
return 0;
}
if (c[i] != -1) {
cout << c[i];
return 0;
}
if (a[i] != -1) {
cout << a[i];
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int dist(int a) { return min(abs(a), abs(360 - abs(a))); }
int main() {
long long x;
cin >> x;
x = -x;
x %= 360;
if (x < 0) x += 360;
int optturn = 0;
int mind = dist(x);
for (int turn = 1; turn < 4; turn++) {
if (dist(x + turn * 90) < mind) {
mind = dist(x + turn * 90);
optturn = turn;
}
}
cout << optturn << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k, p, m;
cin >> n;
n = n % 360;
if (n >= 315 || (n >= -45 && n <= 0)) {
cout << 0;
return 0;
}
if (n < 0) n = 360 + n;
k = n / 90;
p = n % 90;
if (p <= 45)
cout << k;
else
cout << k + 1;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
cin >> x;
x = ((x % 360) + 360) % 360;
int m = 360;
int anw = 0;
for (int i = 0; i < 4; i++) {
int p = abs(i * 90 - x);
p = min(p, 360 - p);
if (p < m) {
m = p;
anw = i;
}
}
cout << anw << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
n %= 360;
n = (n + 360) % 360;
if (n <= 45 || n >= 315) cout << 0 << endl;
if (n <= 135 && n > 45) cout << 1 << endl;
if (n <= 225 && n > 135) cout << 2 << endl;
if (n < 315 && n > 225) cout << 3 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
long long x;
int a[4];
int main() {
scanf("%lld", &x);
x %= 360;
x = (-x + 360) % 360;
a[0] = x;
for (int i = 1; i <= 3; ++i) a[i] = (a[i - 1] + 90) % 360;
for (int i = 0; i < 4; ++i) a[i] = min(a[i], 360 - a[i]);
int ans = 0;
for (int i = 1; i <= 3; ++i)
if (a[i] < a[ans]) ans = i;
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int x, k = 0;
cin >> x;
if (x < 0) {
while (x < -360) {
x %= 360;
k = abs(x);
}
if (x < 0) {
k = x + 360;
}
} else if (x < 360)
k = x;
while (x > 360) {
x %= 360;
k = x;
}
if (k >= 315)
cout << 0;
else if (k > 270)
cout << 3;
else if (k > 225)
cout << 3;
else if (k > 180)
cout << 2;
else if (k > 135)
cout << 2;
else if (k > 90)
cout << 1;
else if (k > 45)
cout << 1;
else if (k >= 0)
cout << 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long int def(long long int n) {
if (n < 0) n = -n;
if (n < 180) return n;
return 360 - n;
}
int main() {
long long int n;
cin >> n;
if (n > 0) {
n = n % 360;
n = (-1) * n;
} else
n = (((-1) * n) % 360);
long long int ans = def(n);
int out = 0;
n += 90;
n %= 360;
long long int now = def(n);
if (now < ans) {
out = 1;
ans = now;
}
n += 90;
n %= 360;
now = def(n);
if (now < ans) {
out = 2;
ans = now;
}
n += 90;
n %= 360;
now = def(n);
if (now < ans) {
out = 3;
ans = now;
}
cout << out;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
n = n % 360;
if (n < 0) n += 360;
if (n <= 45 || n >= 315) cout << 0;
if (n > 45 && n <= 135) cout << 1;
if (n > 135 && n <= 225) cout << 2;
if (n > 225 && n < 315) cout << 3;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
cin >> n;
n = (n % 360 + 360) % 360;
n = (n + 44) % 360;
;
long long ans = (n % 359) / 90;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int maxm = 1e6 + 10;
const int INF = 0x3f3f3f3f;
long long casn, n, m, k;
long long num[maxn];
const long long mod = 100000ll;
long long p(long long a, long long b) {
long long x = 1;
while (b) {
if (b & 1) x = (x * a);
a = (a * a);
b >>= 1;
}
return x;
}
int main() {
long long n;
cin >> n;
n %= 360;
if (n < 0) n += 360;
if (n <= 45 || n >= 315)
cout << 0 << endl;
else if (n <= 135 && n > 45)
cout << 1 << endl;
else if (n > 135 && n <= 225)
cout << 2 << endl;
else
cout << 3 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
signed long long int an(signed long long int x) {
signed long long int ans1, ans2, ans;
signed long long int a = x % 360;
ans1 = abs(a) < abs((a + 360) % 360) ? a : (a + 360) % 360;
ans2 = abs(a) < abs((a - 360) % 360) ? a : (a - 360) % 360;
ans = abs(ans1) < abs(ans2) ? ans1 : ans2;
return (ans);
}
int main() {
signed long long int n, turns[4], turns_abs[4];
cin >> n;
turns[0] = n % 360;
if (abs(turns[0]) >= 315) {
cout << 0;
return (0);
}
turns_abs[0] = (abs(turns[0] - 270) == abs(turns[0] - 360))
? abs(turns[0] - 360)
: abs(turns[0]);
turns_abs[0] = abs(turns[0]);
signed long long int min = turns_abs[0], minind = 0;
for (signed long long int i = 1; i < 4; i++) {
turns[i] = (turns[i - 1] - 90) % 360;
turns_abs[i] = abs(an(turns[i]));
if (min > turns_abs[i]) {
min = turns_abs[i];
minind = i;
}
}
cout << minind;
return 0;
}
|
#include <bits/stdc++.h>
long long n;
int main() {
scanf("%I64d", &n);
n %= 360;
n = (n + 405) % 360 - 1;
printf("%d\n", n / 90);
scanf("\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
n %= 360;
if ((n > -360 && n <= -315) || (n >= -45 && n <= 45) || (n >= 315 && n < 360))
printf("0\n");
else if ((n > 45 && n <= 135) || (n > -315 && n <= -225))
printf("1\n");
else if ((n > 135 && n <= 225) || (n > -225 && n <= -135))
printf("2\n");
else
printf("3\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void remax(T& A, T B) {
if (A < B) A = B;
}
template <class T>
inline void remin(T& A, T B) {
if (A > B) A = B;
}
string ToString(long long num) {
string ret;
do {
ret += ((num % 10) + '0');
num /= 10;
} while (num);
reverse(ret.begin(), ret.end());
return ret;
}
long long ToNumber(string s) {
long long r = 0, p = 1;
for (int i = s.size() - 1; i >= 0; --i) r += (s[i] - '0') * p, p *= 10;
return r;
}
long long Gcd(long long a, long long b) {
while (a %= b ^= a ^= b ^= a)
;
return b;
}
long long Power(long long base, long long power) {
if (power < 0) return 0;
long long ret = 1;
while (power) {
if (power & 1) ret *= base;
power >>= 1;
base *= base;
}
return ret;
}
long long PowerMod(long long base, long long power, long long mod) {
if (!power) return 1;
if (power & 1) return (base * PowerMod(base, power - 1, mod)) % mod;
return PowerMod((base * base) % mod, power >> 1, mod);
}
int Log(long long num, long long base) {
int ret = 0;
while (num) {
++ret;
num /= base;
}
return ret;
}
int Count(long long mask) {
int ret = 0;
while (mask) {
if (mask & 1) ++ret;
mask >>= 1;
}
return ret;
}
long long f(long long x) {
x %= 360;
if (x < 0) x += 360;
if (x > 360 - x) x = 360 - x;
return x;
}
inline void run() {
long long x;
int ans = 0;
scanf("%I64d", &x);
for (int i = 1; i < 5; ++i)
if (f(x - 90 * i) < f(x - 90 * ans)) ans = i;
printf("%d\n", ans);
}
int main() {
FILE* input = stdin;
FILE* output = stdout;
while (!feof(input)) {
run();
break;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
int i, mini, turn = 0, k;
cin >> x;
if (x < 0)
x = -(abs(x) % 360);
else
x = x % 360;
x = -x;
mini = min(abs(x), 360 - abs(x));
for (i = 1; i <= 3; i++) {
x += 90;
if (x < 0)
x = -(abs(x) % 360);
else
x = x % 360;
k = min(abs(x), 360 - abs(x));
if (k < mini) {
mini = k;
turn = i;
}
}
cout << turn;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void precalc() {}
int gcd(int a, int b) {
if (a < b) {
swap(a, b);
}
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
long long x;
int get_val(int k) {
int val1 = min(k, 360 - k);
int val2 = INT_MAX;
return min(val1, val2);
}
int solve() {
scanf("%I64d", &x);
x %= 360;
if (x < 0) {
x += 360;
}
int best = get_val(x), ans = 0;
for (int i = 1; i < 10; ++i) {
x = ((x - 90) % 360 + 360) % 360;
if (get_val(x) < best) {
best = get_val(x);
ans = i;
}
}
printf("%d\n", ans);
return 0;
}
int main() {
precalc();
int t;
t = 1;
for (int i = 1; i <= t; ++i) {
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int C = 360, T = 44;
long long int ang;
cin >> ang;
ang = ((ang % C) + C) % C;
ang = (ang + T) % C;
cout << ((ang % (C - 1)) / (C / 4)) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1;
const double pi = acos(-1.0);
int main() {
long long n;
cin >> n;
n = (n % 360 + 360) % 360;
n = (n + 44) % 360;
n %= 359;
cout << n / 90;
return 0;
}
|
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
long long mask;
long long n;
long long ans = 0;
int mix[] = {0, 2, 4, 3, 1};
string st, blend;
void solve() {
cin >> n;
n %= 360;
int alfa = min(abs(n), 360 - n);
n = (360 + n) % 360;
int ans = n / 90;
n -= ans * 90;
if (90 < 2 * n) {
n -= 90;
ans++;
}
if (alfa <= abs(n))
cout << 0;
else
cout << ans;
}
int main() {
srand(1313);
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int main() {
long long x;
cin >> x;
x = (x % 360 + 360) % 360;
x = (x + 44) % 360;
cout << (x % 359) / 90 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
n = (n + 45) % 360;
if (n < 0) n += 360;
cout << (n - 1) / 90 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
long long x;
int main() {
scanf("%I64d", &x);
x = (x % 360 + 360) % 360;
x = 360 - x;
int ans = 0;
for (int i = 1; i < 4; i++) {
int tans = min((x + ans * 90) % 360, 360 - (x + ans * 90) % 360);
int ti = min((x + i * 90) % 360, 360 - (x + i * 90) % 360);
if (ti < tans) ans = i;
}
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
int main() {
long long n;
scanf("%I64d", &n);
n = n % 360 + (n < 0 ? 360 : 0);
printf("%d\n",
n <= 45 ? 0 : (n <= 135 ? 1 : (n <= 225 ? 2 : (n < 315 ? 3 : 0))));
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long int i, j, x, n, cnt = 0, m;
cin >> n;
m = n / 360;
n -= m * 360;
m = 0;
n = -n;
if (n == 0) {
cout << m;
return 0;
}
if (n < -45) {
if (n >= -135)
m += 1;
else if (n >= -225)
m += 2;
else if (n > -315)
m += 3;
}
if (n > 45) {
if (n < 135)
m += 3;
else if (n < 225)
m += 2;
else if (n < 315)
m += 1;
}
cout << m;
}
|
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int first = 0, f = 1;
char ch = getchar();
for (; ch < '0' || ch > '9';) {
if (ch == '-') f = -1;
ch = getchar();
}
for (; ch >= '0' && ch <= '9';) {
first = first * 10 + ch - '0';
ch = getchar();
}
return first * f;
}
int main() {
long long first;
scanf("%I64d", &first);
printf("%I64d\n", ((first % 360 + 405) % 360 - 1) / 90);
}
|
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7, Base = 998244353;
const long long N = 3e5 + 7;
const long long INF = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7LL;
const double pie = acos(-1.0);
long long a, Min = 90, Rotate;
void adjust(long long &a) {
if (a < 0)
a += (abs(a) / 360) * 360;
else
a -= (abs(a) / 360) * 360;
if (a < -180) a = 180 - abs(-180 - a);
}
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> a;
adjust(a);
a = 90 + a;
adjust(a);
Min = abs(a - 90);
for (long long i = 1; i <= 4; ++i) {
adjust(a);
a -= 90;
adjust(a);
if (abs(90 - a) < Min) Min = abs(90 - a), Rotate = i;
}
cout << Rotate << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5010;
const int mod = 100;
const int INF = 0x3f3f3f3f;
const double pi = acos(-1.0);
const double eps = 1e-4;
int main() {
long long n;
cin >> n;
n = (n % 360 + 360) % 360;
if (n > 45 && n <= 135)
puts("1");
else if (n > 135 && n <= 225)
puts("2");
else if (n > 225 && n < 315)
puts("3");
else
puts("0");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 1;
const int mod = 10007;
int a[18][18];
int main() {
ios_base::sync_with_stdio(0);
long long n;
cin >> n;
n %= 360;
if (n < 0) n += 360;
n = 360 - n;
int ans = 0;
int mn = min(n, 360 - n);
int i = 1;
while (i < 100) {
n += 90;
n %= 360;
int d = min(n, 360 - n);
if (d < mn) {
mn = d;
ans = i;
}
i++;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int64_t x;
int minv = 666, ans;
int main() {
cin >> x;
x = -x;
if ((x %= 360) < 0) x += 360;
for (int i = 0; i < 4; ++i) {
if (min(x, 360 - x) < minv) minv = min(x, 360 - x), ans = i;
x = (x + 90) % 360;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
scanf("%I64d", &x);
x %= 360ll;
long long t = 360ll - x;
t %= 360ll;
long long Min = 360ll;
int opt;
for (int i = 0; i <= 10; i++) {
if (min(t, 360ll - t) < Min) {
Min = min(t, 360ll - t);
opt = i;
}
t += 90ll;
t %= 360ll;
}
printf("%d", opt);
}
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
struct Sync_stdio {
Sync_stdio() {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
}
} _sync_stdio;
int main() {
long long n;
cin >> n;
n = (n + 1800000000000000000LL);
n %= 360;
cout << ((n + 45) / 90) % 4 - (n == 45) - (n == 135) - (n == 225);
}
|
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
long long int n;
cin >> n;
n = n - ((n / 360) * 360);
n = -n;
if (n < 0) {
n = n + 360;
}
long long int AnswerTurns = 0;
long long int MindeviationFromVertical;
MindeviationFromVertical = min(360 - n, n - 0);
long long int TempDeviation;
for (long long int i = 0; i <= 3; i++) {
long long int Hold = n + (90 * i);
if (Hold > 360) {
Hold -= 360;
}
if (min(360 - Hold, Hold - 0) < MindeviationFromVertical) {
MindeviationFromVertical = min(360 - Hold, Hold - 0);
AnswerTurns = i;
}
}
cout << AnswerTurns;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool in_range(long long l, long long v, long long r) {
return (l <= v && v <= r);
}
int main() {
long long x;
cin >> x;
x = ((-x) % 360 + 360) % 360;
int ans = 0;
if (x >= 225 && x < 315)
ans = 1;
else if (x >= 135 && x < 225)
ans = 2;
else if (x > 45 && x < 135)
ans = 3;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long double E = 1e-9;
template <typename T>
T sqr(T t) {
return t * t;
}
long long get(long long n) {
if (n < 0) {
n = 360 + n;
}
return min(360 - n, n);
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
cout.precision(12);
cout << fixed;
srand(time(NULL));
long long n;
cin >> n;
if (n < 0) {
n = (-n) % 360;
n = (360 - n) % 360;
}
n %= 360;
long long best = get(n);
long long ans = 0;
for (long long i = 1; i <= 10; i++) {
n = (n + 360 - 90) % 360;
long long w = get(n);
if (best > w) {
best = w;
ans = i;
}
}
cout << ans;
}
|
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
const double eps = 1e-7;
const double pi = acos(-1.0);
const long long INF = (long long)2e9 + 1;
const long long LINF = (long long)8e18;
const long long inf = (long long)2e9 + 1;
const long long linf = (long long)8e18;
const long long MM = (long long)1e9 + 7;
int solve();
void gen();
int main() {
solve();
return 0;
}
const int dd = 3e5 + 7;
int get(int t) {
while (t < 0) t += 360;
while (t > 360) t -= 360;
return min(t, 360 - t);
}
int solve() {
long long x;
cin >> x;
x *= -1;
x %= 360;
vector<pair<int, int> > M;
M.push_back(make_pair(get(x), 0));
M.push_back(make_pair(get(x + 90), 1));
M.push_back(make_pair(get(x + 180), 2));
M.push_back(make_pair(get(x + 270), 3));
sort(M.begin(), M.end());
cout << M[0].second;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
while (cin >> x) {
x *= -1;
x %= 360;
int res = 0, mn = min(abs(x), 360 - abs(x)), tmp = 1;
while (x + 90 < 360) {
x += 90;
if (min(abs(x), 360 - x) < mn) mn = min(abs(x), 360 - x), res = tmp;
tmp++;
}
x += 90;
x %= 360;
while (x < 360) {
if (min(abs(x), 360 - x) < mn) mn = min(abs(x), 360 - x), res = tmp;
tmp++;
x += 90;
}
cout << res << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
long long n;
int main() {
int i, j, k;
cin >> n;
n %= 360;
n *= -1;
n += 360;
n %= 360;
vector<pair<int, int> > v;
v.emplace_back(n, 0);
v.emplace_back(n + 90, 1);
v.emplace_back(n + 180, 2);
v.emplace_back(n + 270, 3);
for (auto &e : v) e.first %= 360;
for (auto &e : v)
if (e.first > 180) e.first = 360 - e.first;
sort((v).begin(), (v).end());
cout << v[0].second;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long a[4];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long x;
cin >> x;
if (x >= 0) {
a[0] = x % 360;
a[1] = a[0] - 90;
a[2] = a[1] - 90;
a[3] = a[2] - 90;
} else {
x = -x;
a[0] = x % 360;
a[1] = a[0] + 90;
a[2] = a[1] + 90;
a[3] = a[2] + 90;
}
int j = 0;
long long m = 410000;
for (int i = 0; i < 4; i++) {
a[i] = abs(a[i]) % 360;
if (a[i] > 180) a[i] = 360 - a[i];
if (a[i] < m) {
m = a[i];
j = i;
}
}
cout << j;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
n = (n % 360 + 360) % 360;
for (int i = 1; i < 4; i++)
if (abs(n - 90 * i) < abs(n - 90 * ans)) ans = i;
if (n >= 360 - 45) ans = 0;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
cin >> n;
n %= 360;
if (n < 0) n += 360;
if (n >= 315 || n <= 45) cout << 0;
if (n > 45 && n <= 135) cout << 1;
if (n > 135 && n <= 225) cout << 2;
if (n > 225 && n < 315) cout << 3;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
cin >> x;
bool f = 0;
if (x < 0) f = 1;
x = abs(x);
x %= 360;
if (x < 0) x += 360;
if (f) x = 360 - x;
int min1 = 361;
int ans;
int cnt = 0;
while (x >= 0) {
int by = min(x, 360 - x);
if (by < min1) {
min1 = by;
ans = cnt;
}
cnt++;
x -= 90;
}
if (x < 0) {
x = -x;
int by = x;
if (by < min1) {
min1 = by;
ans = cnt;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int mo = 360;
inline unsigned long long Readint() {
unsigned long long ret = 0;
int f = -1;
char ch;
do {
ch = getchar();
if (ch == '-') f *= -1;
} while (ch >= 0 && (ch < '0' || ch > '9'));
while ('0' <= ch && ch <= '9') {
ret = ret * 10 + ch - '0';
ch = getchar();
}
ret %= mo;
if (f > 0)
return ret;
else
return mo - ret;
}
void open() {
freopen("M.in", "r", stdin);
freopen("M.out", "w", stdout);
}
void close() {
fclose(stdin);
fclose(stdout);
}
int cnt[400] = {0};
int x;
int main() {
int _ = 0;
x = Readint();
memset(cnt, -1, sizeof(cnt));
cnt[x] = 0;
do {
x = (x + 90) % mo;
if (cnt[x] >= 0) break;
cnt[x] = ++_;
} while (1);
int ret = 1e9;
for (int i = 0, _END_ = 180; i <= _END_; i++)
if (cnt[i] >= 0 || cnt[360 - i] >= 0) {
if (cnt[i] >= 0) ret = cnt[i];
if (cnt[360 - i] >= 0) ret = min(ret, cnt[360 - i]);
printf("%d\n", ret);
break;
}
close();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n;
pair<int, int> sol;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
n = (n % 360 + 360) % 360;
sol = pair<int, int>(min(n, 360 - n), 0);
n = (n + 270) % 360;
sol = min(sol, pair<int, int>(min(n, 360 - n), 1));
n = (n + 270) % 360;
sol = min(sol, pair<int, int>(min(n, 360 - n), 2));
n = (n + 270) % 360;
sol = min(sol, pair<int, int>(min(n, 360 - n), 3));
cout << sol.second << '\n';
;
}
|
#include <bits/stdc++.h>
int main() {
long long int x;
scanf("%lld", &x);
long long int a = 0;
long long int n = 0;
if (x < 0) {
a = (x % 360 + 360) % 360;
if (a >= 0 && a <= 44)
printf("0");
else if (a == 45)
printf("0");
else if (a >= 46 && a <= 134)
printf("1");
else if (a == 135)
printf("1");
else if (a >= 136 && a <= 224)
printf("2");
else if (a == 225)
printf("2");
else if (a >= 226 && a <= 314)
printf("3");
else if (a == 315)
printf("0");
else if (a >= 316 && a <= 360)
printf("0");
} else if (x >= 0) {
n = (x % 360 + 360) % 360;
if (n >= 0 && n <= 44)
printf("0");
else if (n == 45)
printf("0");
else if (n >= 46 && n <= 134)
printf("1");
else if (n == 135)
printf("1");
else if (n >= 136 && n <= 224)
printf("2");
else if (n == 225)
printf("2");
else if (n >= 226 && n <= 314)
printf("3");
else if (n == 315)
printf("0");
else if (n >= 316 && n <= 360)
printf("0");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
n *= -1;
n %= 360;
if (n < 0) n += 360;
n %= 360;
int k = 0, m = min(n, 360 - n);
for (int i = 1; i <= 1000; i++) {
n += 90;
n %= 360;
if (min(n, 360 - n) < m) {
m = min(n, 360 - n);
k = i;
}
}
cout << k;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
int tn, ans, cha;
while (~scanf("%I64d", &x)) {
tn = (x % 360 + 360) % 360;
cha = min(tn, 360 - tn);
ans = 0;
for (int i = 1; i <= 3; i++) {
tn = (tn + 270) % 360;
if (cha > min(tn, 360 - tn)) {
cha = min(tn, 360 - tn);
ans = i;
}
}
printf("%d\n", ans);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
n = n % 360;
int angle;
angle = -n;
int m = min(abs(n), 360 - abs(n)), pos = 0;
for (int i = 0; i < 3; ++i) {
angle += 90;
int u = min(angle, 360 - angle);
if (abs(u) < abs(m)) {
m = u;
pos = i + 1;
}
}
cout << pos << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
set<long long> s;
int main() {
long long x, y, arr[181] = {0};
cin >> x;
y = x % 360;
long long dev, deg, k, cnt = 0, temp, t, i;
deg = y * (-1);
for (i = 0; i < 10; i++) {
deg = deg % 360;
k = abs(deg);
dev = min(k, 360 - k);
if (s.find(dev) == s.end()) {
s.insert(dev);
arr[dev] = cnt;
}
cnt++;
deg += 90;
}
t = *s.begin();
cout << arr[t];
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long x;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> x;
int mn = 360, res = 0;
for (int i = 0; i < 4; i++) {
int d = min(((((-x + 90 * i) % (360)) + (360)) % (360)),
360 - ((((-x + 90 * i) % (360)) + (360)) % (360)));
if (d < mn) {
mn = d;
res = i;
}
}
cout << res << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int x;
cin >> x;
x %= 360;
if (x < 0) {
x += 360;
}
long long int x1, x2, x3, x4;
x1 = x;
x2 = x - 90;
x3 = x - 180;
x4 = x - 270;
if (x1 < 0) {
x1 += 360;
}
if (x2 < 0) {
x2 += 360;
}
if (x3 < 0) {
x3 += 360;
}
if (x4 < 0) {
x4 += 360;
}
if (x1 > 180) {
x1 = 360 - x1;
}
if (x2 > 180) {
x2 = 360 - x2;
}
if (x3 > 180) {
x3 = 360 - x3;
}
if (x4 > 180) {
x4 = 360 - x4;
}
long long int ans = min(x4, min(x3, min(x1, x2)));
if (ans == x1) {
cout << 0 << endl;
return 0;
}
if (ans == x2) {
cout << 1 << endl;
return 0;
}
if (ans == x3) {
cout << 2 << endl;
return 0;
}
if (ans == x4) {
cout << 3 << endl;
return 0;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
cin >> x;
x %= 360;
if ((x >= -45 && x <= 45) || (x >= 315 && x <= 360) ||
(x <= -315 && x >= -360))
cout << 0;
else if (x < 0) {
int dist = 2000000000, fini;
for (int i = 0; i < 4; i++) {
x -= 90;
x %= 360;
if (x >= -180) {
if (dist > -x) {
dist = -x;
fini = i;
}
} else {
if (dist > x + 360) {
dist = x + 360;
fini = i;
}
}
}
cout << (fini + 1) % 4;
} else {
int dist = 2000000000, fini;
for (int i = 0; i < 4; i++) {
x += 270;
x %= 360;
if (x <= 180) {
if (dist > x) {
dist = x;
fini = i;
}
} else {
if (dist > 360 - x) {
dist = 360 - x;
fini = i;
}
}
}
cout << (fini + 1) % 4;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long double radian = 180 / acos(-1);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long x, mini = LLONG_MAX, p;
cin >> x;
x %= 360;
if (x < 0) x = 360 + x;
for (int i = 0; i < 4; i++) {
if (min(x, 360 - x) < mini) {
mini = min(x, 360 - x);
p = i;
}
x = (x + 270) % 360;
}
cout << p;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
int a, mna = 1000, mnb;
cin >> x;
a = (-x) % 360;
if (a < 0) a += 360;
if (abs(a) < mna || abs(360 - a) < mna) {
mna = min(abs(a), abs(360 - a));
mnb = 0;
}
a += 90;
if (abs(a) < mna || abs(360 - a) < mna) {
mna = min(abs(a), abs(360 - a));
mnb = 1;
}
a += 90;
if (abs(a) < mna || abs(360 - a) < mna) {
mna = min(abs(a), abs(360 - a));
mnb = 2;
}
a += 90;
if (abs(a) < mna || abs(360 - a) < mna) {
mna = min(abs(a), abs(360 - a));
mnb = 3;
}
cout << mnb << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
n = (n % 360 + 360) % 360;
if (n >= 315)
n = 0;
else
n += 44;
cout << n / 90;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = (1LL << 30) - 1;
const long long int LINF = (1LL << 62) - 1;
int main() {
cin.sync_with_stdio(false);
long long int n;
pair<long long int, long long int> sol = {LINF, LINF};
scanf("%lld", &n);
n %= 360;
n += 360;
n %= 360;
for (int i = 0; i <= 6; i++) {
long long int ang = n - i * 90;
ang %= 360;
ang += 360;
ang %= 360;
long long int a = min(ang, 360 - ang);
sol = min(sol, {a, 1LL * i});
}
printf("%lld\n", sol.second);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
n = (n % 360 + 360) % 360;
if (n >= 0 && 45 >= n) {
cout << "0";
}
if (n >= 46 && 135 >= n) {
cout << "1";
}
if (n >= 136 && 225 >= n) {
cout << "2";
}
if (n >= 226 && 314 >= n) {
cout << "3";
}
if (n >= 315 && 359 >= n) {
cout << "0";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
long long x;
cin >> x;
x = (x % 360 + 360) % 360;
int ans = -1, mn = -1;
for (int i = 0; i < 4; i++) {
if (ans == -1 || mn > min(x, 360 - x)) {
ans = i;
mn = min(x, 360 - x);
}
x = (x + 270) % 360;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long calc(long long d) {
d = (d % 360 + 360) % 360;
return min(d, 360 - d);
}
int main() {
long long d;
cin >> d;
int ans = 0;
if (calc(d - 90 * 1) < calc(d - 90 * ans)) ans = 1;
if (calc(d - 90 * 2) < calc(d - 90 * ans)) ans = 2;
if (calc(d - 90 * 3) < calc(d - 90 * ans)) ans = 3;
cout << ans << endl;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.