Codeforces Round #268 (Div. 2)_html/css_WEB-ITnose
Codeforces Round #268 (Div. 2)
Question link
A: Just mark some and judge them
B: Just judge the enumeration times one by one. Can
C: Construct it. 4 and 5 are constructed manually respectively. Then each time there are 2 more numbers, subtract them first to get 1, then multiply by the original number and it remains unchanged. Numbers below 4 cannot be constructed at all.
D: Greedy, sort first, and then each twopointer selects the first and last two to determine which set it can throw into. If it doesn’t work, just find a satisfactory one and throw it into the small set
E: For reasoning, see the official solution for details. After deducing, the interval [x, x 1e18 - 1] is moved one at a time to become [x 1, x 1e18], and the corresponding sum is increased by 1. So as long as it can be calculated [1, 1e18], and then move the corresponding number of steps to get the corresponding interval. Calculate the sum and push rules of 1-1e18 to find out. The official solution also has the formula
Code:
A:
#include <cstdio>#include <cstring>int n, p, q, vis[105];bool solve() { for (int i = 1; i <= n; i++) if (vis[i] == 0) return false; return true;}int main() { scanf("%d", &n); scanf("%d", &p); int tmp; for (int i = 0; i < p; i++) { scanf("%d", &tmp); vis[tmp] = 1; } scanf("%d", &q); for (int i = 0; i < q; i++) { scanf("%d", &tmp); vis[tmp] = 1; } printf("%s\n", solve() ? "I become the guy." : "Oh, my keyboard!"); return 0;}
B:
#include <cstdio>#include <cstring>const int N = 55;int p, q, l, r, ans;int vis[10005], c[N], d[N];bool judge(int t) { for (int i = 0; i < q; i++) { for (int j = c[i]; j <= d[i]; j++) { if (vis[j + t]) return true; } } return false;}int main() { scanf("%d%d%d%d", &p, &q, &l, &r); int a, b; for (int i = 0; i < p; i++) { scanf("%d%d", &a, &b); for (int j = a; j <= b; j++) vis[j] = 1; } for (int i = 0; i < q; i++) scanf("%d%d", &c[i], &d[i]); for (int i = l; i <= r; i++) { if (judge(i)) ans++; } printf("%d\n", ans); return 0;}
C:
#include <cstdio>#include <cstring>#include <vector>#include <algorithm>using namespace std;int n;void solve(int n) { if (n % 2 == 0) { printf("1 + 2 = 3\n"); printf("3 + 3 = 6\n"); printf("6 * 4 = 24\n"); for (int i = 5; i <= n; i += 2) { printf("%d - %d = 1\n", i + 1, i); printf("24 * 1 = 24\n"); } } else { printf("5 - 3 = 2\n"); printf("1 + 2 = 3\n"); printf("2 * 3 = 6\n"); printf("4 * 6 = 24\n"); for (int i = 6; i <= n; i += 2) { printf("%d - %d = 1\n", i + 1, i); printf("24 * 1 = 24\n"); } }}int main() { scanf("%d", &n); if (n < 4) printf("NO\n"); else { printf("YES\n"); solve(n); } return 0;}
D:
#include <cstdio>#include <cstring>#include <map>#include <algorithm>using namespace std;const int N = 100005;int n, a, b;map<int, int> to;struct Seq { int num, id, to, vis;} s[N];bool cmp(Seq a, Seq b) { return a.num < b.num;}bool cmpid(Seq a, Seq b) { return a.id < b.id;}int flag = 0;bool solve() { int st = 0, ed = n - 1; while (st <= ed) { if (s[st].vis) { st++; continue; } if (s[ed].vis) { ed--; continue; } if (s[st].num + s[ed].num > b || s[st].num + s[ed].num < a) return false; if (s[st].num + s[ed].num == b) { s[st].vis = 1; s[ed].vis = 1; s[st].to = 1; s[ed].to = 1; st++; ed--; continue; } else if (s[st].num + s[ed].num == a) { s[st].vis = 0; s[ed].vis = 0; s[st].to = 0; s[ed].to = 0; st++; ed--; } else { if (!to.count(a - s[st].num)) return false; int v = to[a - s[st].num]; if (s[v].vis) return false; s[v].to = 0; s[v].vis = 1; s[st].vis = 1; s[st].to = 0; st++; } } sort(s, s + n, cmpid); printf("YES\n"); printf("%d", s[0].to^flag); for (int i = 1; i < n; i++) printf(" %d", s[i].to^flag); printf("\n"); return true;}int main() { scanf("%d%d%d", &n, &a, &b); if (a > b) { swap(a, b); flag = 1; } for (int i = 0; i < n; i++) { scanf("%d", &s[i].num); s[i].id = i; } sort(s, s + n, cmp); for (int i = 0; i < n; i++) to[s[i].num] = i; if (!solve()) printf("NO\n"); return 0;}
E:
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const ll INF = 1e18;ll a;int main() { scanf("%lld", &a); ll num = INF / 10 % a; num = num * 2 % a; num = num * 9 % a; num = num * 9 % a; num = num * 5 % a; printf("%lld %lld\n", a - num, a - num + INF - 1); return 0;}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...
