This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure TForm1.DrawCircle3(cx, cy, r: Integer); | |
var | |
angle, angleInc : Extended; | |
i : integer; | |
x, y, sina, sinb, cosa, cosb, sinab, cosab : Extended; | |
begin | |
PaintBox1.Canvas.MoveTo(cx + r, cy); | |
angleinc := 360 / r; | |
sinb := Sin(angleinc / (180.0 / 3.14159)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define vec vector | |
#define vint vector<int> | |
#define vstr vector<string> | |
#define pb push_back | |
#define eb emplace_back | |
#define mp make_pair | |
#define st string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<string> split(string s) | |
{ | |
vector<string> sRet; | |
size_t i = 0; | |
do | |
{ | |
string sWord; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<string> split2(string s) | |
{ | |
vector<string> sRet; | |
istringstream iss(s); | |
string sWord; | |
while(iss >> sWord) | |
sRet.push_back(sWord); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<string> split3(string s) | |
{ | |
istringstream iss(s); | |
istream_iterator<string> begi(iss), endi; | |
return vector<string>(begi, endi); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<int> v(istream_iterator<int>(istringstream(s)), istream_iterator<int>()); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<string> split(const string& s, string seps=" ") | |
{ | |
vector<string> ret; | |
for(auto ps = &s[0], pd = ps, pe = ps + int(s.size()); ps < pe; ps = pd + 1) | |
{ | |
ret.emplace_back(string(ps, pd = find_first_of(ps, pe, begin(seps), end(seps)))); | |
} | |
return ret; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vstr split(cstref s, st seps=" ") | |
{ | |
vstr ret; | |
for(auto ps = pbeg(s), pd = ps, pe = ps + sz(s); ps < pe; ps = pd + 1) | |
ret.eb(st(ps, pd = find_first_of(ps, pe, all(seps)))); | |
return ret; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | |
int days_acc[13] = {0}; | |
partial_sum(days, days+12, days_acc+1); | |
int date2day(int m, int d) | |
{ | |
return days_acc[m] + d; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <deque> | |
#include <algorithm> | |
#include <functional> | |
#include <set> | |
#include <numeric> |
OlderNewer