This file contains 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 <cstdio> | |
#include <algorithm> | |
using namespace std; | |
int main() | |
{ | |
int n, count, triangles; | |
unsigned long points[100003], temp, interval, sum, p2, p3; | |
This file contains 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 <cstdio> | |
#include <map> | |
using namespace std; | |
int getCollatz(long a, map<long,int> &source) | |
{ | |
if( source.find(a) == source.end() ) | |
{ | |
if(a%2 == 0) |
This file contains 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
int divs[MAX]; | |
void slowSieve(int n) | |
{ | |
memset(divs, 0, sizeof divs); | |
for( int i = 2; i <= n; i++ ) | |
if( divs[i] == 0 ) // Achei primo | |
{ | |
divs[i] = -1; // Fix, pois vou contar o primo em si | |
// Percorro todas as potências desse primo |
This file contains 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 MAX 5000042 | |
using namespace std; | |
int divs[MAX]; | |
void slowSieve(int n) | |
{ | |
for( int i = 0; i <= n; i++ ) | |
divs[i] = 0; |
This file contains 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> | |
using namespace std; | |
typedef int num; | |
typedef int cood; | |
typedef int point; | |
const int MP = 1002; | |
const double PI = (acos(-1.0)); | |
const double eps = (1e-9); | |
cood x[MP], y[MP]; | |
point anchor, in[MP], hull[MP]; |
This file contains 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
$comb = Hash.new do |comb, n| | |
if n == 0 | |
comb[n] = Hash.new(0) | |
comb[0][0] = 1; | |
else | |
comb[n] = Hash.new do |hash, k| | |
if k == 0 | |
hash[k] = 1; | |
else | |
hash[k] = comb[n-1][k-1] + comb[n-1][k]; |
This file contains 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> | |
using namespace std; | |
typedef int64_t ll; | |
template<typename T> inline void _max(T& a, T b){ a = max(a,b); } | |
template<typename T> inline void _min(T& a, T b){ a = min(a,b); } | |
int main(){ | |
} |
This file contains 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> | |
using namespace std; | |
typedef int64_t ll; | |
template<typename T> inline void _max(T& a, T b){ a = max(a,b); } | |
template<typename T> inline void _min(T& a, T b){ a = min(a,b); } | |
const int N = 1e6+7; | |
int x[N], f[N], y[N], T[N][2]; | |
int s[2], ts; | |
void split(int t, int k){ |
This file contains 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> | |
using namespace std; | |
typedef int64_t ll; | |
const int N = (2e3) + 7; | |
int n, k, w[N], v[N]; | |
int _S[N][N]; | |
int& S(int i, int w) { return (w >= 0) ? _S[i][w] : _S[N-1][N-1]; } | |
int s(int i, int w) { return max({S(i+1,w), v[i] + S(i+1,w-::w[i])}); } |
This file contains 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 all(v) begin(v), end(v) | |
using namespace std; | |
using ll = int64_t; | |
const int N = 1e5 + 7; | |
int n; | |
int c[N]; | |
vector<int> G[N]; |
OlderNewer