105 lines
2.9 KiB
C++
105 lines
2.9 KiB
C++
#include <algorithm>
|
|
#include <cstdio>
|
|
#include <math.h>
|
|
#include <iostream>
|
|
#include <vector>
|
|
using namespace std;
|
|
|
|
// ----- TYPES -----
|
|
typedef long long ll;
|
|
typedef pair<int,int> pii;
|
|
typedef vector<int> vi;
|
|
|
|
// ----- FILE IO -----
|
|
#define STDIN(filename) freopen(filename, "r", stdin)
|
|
#define STDOUT(filename) freopen(filename, "w", stdout)
|
|
#define FASTIO cin.tie(0)->sync_with_stdio(0)
|
|
#define STDIO(filename) FASTIO; string filenamee(filename); STDIN((filenamee + ".in").c_str()); STDOUT((filenamee + ".out").c_str())
|
|
#define NL '\n'
|
|
#define CM ", "
|
|
|
|
// ----- FOR LOOPS -----
|
|
#define F(i,L,R) for (int i = L; i < R; i++)
|
|
#define FE(i,L,R) for (int i = L; i <= R; i++)
|
|
#define FD(i,L,R) for (int i = L; i > R; i--)
|
|
#define FDE(i,L,R) for (int i = L; i >= R; i--)
|
|
|
|
// ----- WEZ -----
|
|
#define takeI(n) int n; cin >> n
|
|
#define takeII(n,m) int n, m; cin >> n >> m
|
|
#define takeIII(n,m,k) int n, m, k; cin >> n >> m >> k
|
|
#define takeL(n) ll n; cin >> n
|
|
#define takeS(s) string s; cin >> s
|
|
#define takeV(v,n) vi v(n); for (auto &x : v) cin >> x
|
|
#define takeVL(v,n) vector<ll> v(n); for (auto &x : v) cin >> x
|
|
#define whileZ takeI(T); while(T--)
|
|
//
|
|
// ----- MAX MIN -----
|
|
#define REMAX(a,b) (a)=max((a),(b))
|
|
#define REMIN(a,b) (a)=min((a),(b))
|
|
|
|
// ----- PAIRS -----
|
|
#define fi first
|
|
#define se second
|
|
|
|
// ----- OUTPUT -----
|
|
#define YESNO(b) cout << ((b) ? "YES" : "NO") << NL
|
|
|
|
// ----- DEBUG -----
|
|
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl
|
|
#define DBG2(a,b) cerr << #a "=" << (a) << CM << #b "=" << (b) << endl
|
|
#define printA(a,L,R) FE(i,L,R) cerr << a[i] << (i==R?'\n':' ')
|
|
#define printV(a) printA(a,0,SZ(a)-1)
|
|
|
|
// ----- STL DS
|
|
#define ALL(c) (c).begin(),(c).end()
|
|
#define SZ(c) ((int)(c).size())
|
|
#define SORT(c) sort(ALL(c))
|
|
#define RSORT(c) sort(ALL(c), greater<>())
|
|
#define UNIQ(c) SORT(c), (c).erase(unique(ALL(c)), (c).end())
|
|
#define pb push_back
|
|
|
|
const int HEART_SIZE = 20;
|
|
const int HALF_SIZE = HEART_SIZE / 2;
|
|
|
|
bool is_in_love(int x, int y);
|
|
|
|
int main() {
|
|
|
|
string message = " SYSTEMATIC LOVE ";
|
|
int message_indent = (HALF_SIZE - (message.length() / 8)) - 1;
|
|
|
|
for (int y = 0; y < HEART_SIZE; ++y) {
|
|
for (int x = 0; x < HEART_SIZE; ++x) {
|
|
cout << ((is_in_love(x, y)) ? "vvvv" : " ");
|
|
|
|
if (y== HALF_SIZE-1) {
|
|
if (x == message_indent) {
|
|
cout << message.c_str();
|
|
x += (message.length()/4);
|
|
}
|
|
}
|
|
}
|
|
cout << endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
bool is_in_love(int x, int y) {
|
|
const float width = 2.2f;
|
|
const float height = 3.0f;
|
|
const float HEART_COEFFICIENT = 0.7f;
|
|
|
|
float check_x = ((static_cast<float>(x) / static_cast<float>(HEART_SIZE)) - 0.5f) * width;
|
|
float check_y = ((static_cast<float>(HEART_SIZE - y) / static_cast<float>(HEART_SIZE)) - 0.4f) * height;
|
|
|
|
float top_y = sqrt(1 - pow(check_x, 2)) + (HEART_COEFFICIENT * sqrt(abs(check_x)));
|
|
float bottom_y = -sqrt(1 - pow(check_x, 2)) + (HEART_COEFFICIENT* sqrt(abs(check_x)));
|
|
|
|
if ((bottom_y <= check_y) && (check_y <= top_y)) {
|
|
return true;
|
|
}
|
|
else return false;
|
|
}
|