Mosaic
Posted tempestt
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mosaic相关的知识,希望对你有一定的参考价值。
给你三个数字a,b,c,让你用1~m的数字凑出来
结论:有2个1和2个2肯定凑不出来,然后就搜索
#include <bits/stdc++.h> using namespace std; #define rep(i, j, k) for (int i = int(j); i <= int(k); ++ i) #define dwn(i, j, k) for (int i = int(j); i >= int(k); -- i) typedef long long LL; typedef pair<int, int> P; const int N = 3e5 + 7; char col[N]; int dfs(int i, int j, int k, int x) { if (i == 0 && j == 0 && k == 0) return 1; if (i < 0 || j < 0 || k < 0 || x <= 0) return 0; col[x] = 1; if (dfs(i - x, j, k, x - 1)) return 1; col[x] = 2; if (dfs(i, j - x, k, x - 1)) return 1; col[x] = 3; if (dfs(i, j, k - x, x - 1)) return 1; return 0; } int main() { ios::sync_with_stdio(0); LL a, b, c; cin >> a >> b >> c; LL n = a + b + c; LL x = 1; for (x = 1; n > 0; x ++) n -= x; x --; int xx = x; int c1 = (a == 1) + (b == 1) + (c == 1); int c2 = (a == 2) + (b == 2) + (c == 2); if (c1 >= 2 || c2 >= 2 || n != 0) { printf("Impossible\n"); return 0; } dfs(a, b, c, x); // cout << a << ‘ ‘ << b << ‘ ‘ << c << ‘ ‘ << x << ‘\n‘; auto tran = [&](int x) -> char { if (x == 1) return ‘W‘; if (x == 2) return ‘G‘; return ‘B‘; }; rep(i, 1, xx) printf("%c", tran(col[i])); } /* 11 5 5 */
以上是关于Mosaic的主要内容,如果未能解决你的问题,请参考以下文章
[YOLO专题-20]:YOLO V5 - ultralytics代码解析-马赛克数据增强mosaic augment
Anchor free系列网络之YOLOX源码逐行讲解篇--mosaic数据增强及数学理解
R语言ggplot2可视化绘制Marimekko/Mosaic图实战:自定义函数绘制Marimekko/Mosaic图(添加数值标题色彩配置)ggmosaic包绘制Marimekko图