A
根据两个函数的图像可以想到会有两个交点,x = 2和x = 4,其他情况均是2^n大于n^2
AC代码:
/* Tips: 1.int? long long? 2.don't submit wrong answer 3.figure out logic first, then start writing please 4.know about the range 5.check if you have to input t or not 6.modulo of negative numbers is not a%b, it is a%b + abs(b) */ #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize("Ofast") #include <iostream> #include <queue> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <cctype> #include <map> #include <vector> #include <deque> #include <set> #include <stack> #include <numeric> #include <iomanip> #include <functional> using namespace std; #define lowbit(x) ((x) & -(x)) #define IOS1 ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); #define IOS2 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); typedef vector<int> vi; typedef vector<long long> vll; typedef vector<char> vc; typedef long long ll; template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template<class T> T power(T a, int b) { T res = 1; for (; b; b >>= 1, a = a * a) { if (b & 1) { res = res * a; } } return res; } template <typename T> inline void read(T& x) { x = 0; int f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - '0', ch = getchar(); } x *= f; } const int INF = 0x3f3f3f3f; const int mod = 1000000007; const double PI = acos(-1.0); const double eps = 1e-6; inline int sgn(double x) { return x < -eps ? -1 : x > eps; } //计算几何 //向量 //struct Point { // double x, y; // Point operator - (Point a) {//向量加法 // return { x - a.x,y - a.y }; // } // Point operator + (Point a) {//向量减法 // return { x + a.x,y + a.y }; // } // double operator * (Point a) {//点乘 // return x * a.x + y * a.y; // } // double operator % (Point a) {//叉乘 // return x * a.y - y * a.x; // } // bool operator == (Point a) {//两点是否重合 // return !sgn(x - a.x) && !sgn(y - a.y); // } // long double len() {//返回向量的模 // return hypot(x, y); // } // Point rot(long double arg) {//向量旋转 // long double Cos = cos(arg), Sin = sin(arg); // return { x * Cos - y * Sin,x * Sin + y * Cos }; // } //}; //直线 or 射线 //struct Line { // Line() {} // Line (Point s,Point e): s(s),e(s){} // Point s, e; //}; void solve() { int n; cin >> n; if (n >= 2 && n <= 4) { cout << "No" << endl; } else { cout << "Yes" << endl; } } int main() { IOS1; //IOS2; int __t = 1; //cin >> __t; for (int _t = 1; _t <= __t; _t++) { solve(); } return 0; } /* */
B
切皮萨就相当于在0 - 360内不断放入隔板,因为每次都是朝一个方向旋转,所以不断累加然后模360就是在该处放置一个隔板,最后一刀就相当于在倒数第二刀和360之间切了一下,所以最后要在数组里放一个360后排序,最后求差分就好了
AC代码:
/* Tips: 1.int? long long? 2.don't submit wrong answer 3.figure out logic first, then start writing please 4.know about the range 5.check if you have to input t or not 6.modulo of negative numbers is not a%b, it is a%b + abs(b) */ #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize("Ofast") #include <iostream> #include <queue> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <cctype> #include <map> #include <vector> #include <deque> #include <set> #include <stack> #include <numeric> #include <iomanip> #include <functional> using namespace std; #define lowbit(x) ((x) & -(x)) #define IOS1 ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); #define IOS2 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); typedef vector<int> vi; typedef vector<long long> vll; typedef vector<char> vc; typedef long long ll; template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template<class T> T power(T a, int b) { T res = 1; for (; b; b >>= 1, a = a * a) { if (b & 1) { res = res * a; } } return res; } template <typename T> inline void read(T& x) { x = 0; int f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - '0', ch = getchar(); } x *= f; } const int INF = 0x3f3f3f3f; const int mod = 1000000007; const double PI = acos(-1.0); const double eps = 1e-6; inline int sgn(double x) { return x < -eps ? -1 : x > eps; } //计算几何 //向量 //struct Point { // double x, y; // Point operator - (Point a) {//向量加法 // return { x - a.x,y - a.y }; // } // Point operator + (Point a) {//向量减法 // return { x + a.x,y + a.y }; // } // double operator * (Point a) {//点乘 // return x * a.x + y * a.y; // } // double operator % (Point a) {//叉乘 // return x * a.y - y * a.x; // } // bool operator == (Point a) {//两点是否重合 // return !sgn(x - a.x) && !sgn(y - a.y); // } // long double len() {//返回向量的模 // return hypot(x, y); // } // Point rot(long double arg) {//向量旋转 // long double Cos = cos(arg), Sin = sin(arg); // return { x * Cos - y * Sin,x * Sin + y * Cos }; // } //}; //直线 or 射线 //struct Line { // Line() {} // Line (Point s,Point e): s(s),e(s){} // Point s, e; //}; void solve() { int n; cin >> n; vector<int> a{ 0 }; int sum = 0; for (int i = 0; i < n; i++) { int x; cin >> x; sum = (sum + x) % 360; a.push_back(sum); } a.push_back(360); sort(a.begin(), a.end()); int ans = 0; for (int i = 0; i <= n; i++) { ans = max(ans, a[i + 1] - a[i]); } cout << ans << endl; } int main() { IOS1; //IOS2; int __t = 1; //cin >> __t; for (int _t = 1; _t <= __t; _t++) { solve(); } return 0; } /* */
C
AC代码:
/* Tips: 1.int? long long? 2.don't submit wrong answer 3.figure out logic first, then start writing please 4.know about the range 5.check if you have to input t or not 6.modulo of negative numbers is not a%b, it is a%b + abs(b) */ #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize("Ofast") #include <iostream> #include <queue> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <cctype> #include <map> #include <vector> #include <deque> #include <set> #include <stack> #include <numeric> #include <iomanip> #include <functional> using namespace std; #define lowbit(x) ((x) & -(x)) #define IOS1 ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); #define IOS2 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); typedef vector<int> vi; typedef vector<long long> vll; typedef vector<char> vc; typedef long long ll; template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template<class T> T power(T a, int b) { T res = 1; for (; b; b >>= 1, a = a * a) { if (b & 1) { res = res * a; } } return res; } template <typename T> inline void read(T& x) { x = 0; int f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - '0', ch = getchar(); } x *= f; } const int INF = 0x3f3f3f3f; const int mod = 1000000007; const double PI = acos(-1.0); const double eps = 1e-6; inline int sgn(double x) { return x < -eps ? -1 : x > eps; } //计算几何 //向量 //struct Point { // double x, y; // Point operator - (Point a) {//向量加法 // return { x - a.x,y - a.y }; // } // Point operator + (Point a) {//向量减法 // return { x + a.x,y + a.y }; // } // double operator * (Point a) {//点乘 // return x * a.x + y * a.y; // } // double operator % (Point a) {//叉乘 // return x * a.y - y * a.x; // } // bool operator == (Point a) {//两点是否重合 // return !sgn(x - a.x) && !sgn(y - a.y); // } // long double len() {//返回向量的模 // return hypot(x, y); // } // Point rot(long double arg) {//向量旋转 // long double Cos = cos(arg), Sin = sin(arg); // return { x * Cos - y * Sin,x * Sin + y * Cos }; // } //}; //直线 or 射线 //struct Line { // Line() {} // Line (Point s,Point e): s(s),e(s){} // Point s, e; //}; long long mode = 998244353; int c[21], m; void solve() { long long n; cin >> n; for (long long i = n; i; i /= 10) { c[++m] = i % 10; } for (int i = 1, j = m; i < j; i++, j--) { swap(c[i], c[j]); } long long res = 1; long long ans = 0; auto calc = [&](long long n) { long long a = n, b = n + 1; if (a & 1) { b /= 2; } else { a /= 2; } a %= mode; b %= mode; return a * b % mode; }; for (int i = 1; i < m; i++) { res *= 10; ans += calc(res / 10 * 9); ans %= mode; } ans += calc(n - res + 1); ans %= mode; cout << ans << endl; } int main() { IOS1; //IOS2; int __t = 1; //cin >> __t; for (int _t = 1; _t <= __t; _t++) { solve(); } return 0; } /* */
D
AC代码:
/* Tips: 1.int? long long? 2.don't submit wrong answer 3.figure out logic first, then start writing please 4.know about the range 5.check if you have to input t or not 6.modulo of negative numbers is not a%b, it is a%b + abs(b) */ #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize("Ofast") #include <iostream> #include <queue> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <cctype> #include <map> #include <vector> #include <deque> #include <set> #include <stack> #include <numeric> #include <iomanip> #include <functional> using namespace std; #define lowbit(x) ((x) & -(x)) #define IOS1 ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); #define IOS2 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); typedef vector<int> vi; typedef vector<long long> vll; typedef vector<char> vc; typedef long long ll; template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template<class T> T power(T a, int b) { T res = 1; for (; b; b >>= 1, a = a * a) { if (b & 1) { res = res * a; } } return res; } template <typename T> inline void read(T& x) { x = 0; int f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - '0', ch = getchar(); } x *= f; } const int INF = 0x3f3f3f3f; const int mod = 1000000007; const double PI = acos(-1.0); const double eps = 1e-6; inline int sgn(double x) { return x < -eps ? -1 : x > eps; } //计算几何 //向量 //struct Point { // double x, y; // Point operator - (Point a) {//向量加法 // return { x - a.x,y - a.y }; // } // Point operator + (Point a) {//向量减法 // return { x + a.x,y + a.y }; // } // double operator * (Point a) {//点乘 // return x * a.x + y * a.y; // } // double operator % (Point a) {//叉乘 // return x * a.y - y * a.x; // } // bool operator == (Point a) {//两点是否重合 // return !sgn(x - a.x) && !sgn(y - a.y); // } // long double len() {//返回向量的模 // return hypot(x, y); // } // Point rot(long double arg) {//向量旋转 // long double Cos = cos(arg), Sin = sin(arg); // return { x * Cos - y * Sin,x * Sin + y * Cos }; // } //}; //直线 or 射线 //struct Line { // Line() {} // Line (Point s,Point e): s(s),e(s){} // Point s, e; //}; void solve() { long long a, s; cin >> a >> s; long long b = s - a; if (b >= 0 && (b & a) == a) { cout << "Yes" << endl; } else { cout << "No" << endl; } } int main() { IOS1; //IOS2; int __t = 1; cin >> __t; for (int _t = 1; _t <= __t; _t++) { solve(); } return 0; } /* */