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
from math import floor, sqrt | |
ap=True | |
while True: | |
p=int(input()) | |
for i in range (2, floor(sqrt(p))+1): | |
if p%i==0: | |
ap=False | |
break | |
else: | |
ap=True |
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
def sedas(n): | |
B, A = [], [True] * (n + 1) | |
for i in range(2, n + 1): | |
if A[i]: | |
B.append(i) | |
for j in range(i * i, n + 1, i): | |
A[j] = False | |
return B | |
while True: |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
int first_occurrence(double x, const vector<double>& v){ | |
if (v.size()==0) return -1; | |
int inici = 0, final = v.size()-1; | |
while (inici <= final) { | |
int m = (inici + final)/2; | |
if (v[m] < x) ini = m + 1; |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
int first_occurrence(int x, const vector<int>& v){ | |
if (v.size()==0) return -1; | |
int inici = 0, final = v.size()-1; | |
while (inici <= final) { | |
int m = (inici + final)/2; | |
if (v[m] < x) inici = m + 1; |
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 <iostream> | |
using namespace std; | |
int ackerman(int a, int b){ | |
if (a==0) return b+1; | |
else if (b==0) return ackerman(a-1, 1); | |
else return ackerman(a-1, ackerman(a, b-1)); | |
} | |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
struct punt{ | |
int x; | |
int y; | |
int z; | |
}; |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
struct p{ | |
int a; | |
int b; | |
}; | |
p mam(int x, vector<int>& v){ |
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 <iostream> | |
#include <vector> | |
#include <cmath> | |
#include <algorithm> | |
using namespace std; | |
struct punt{ | |
int x; | |
int y; | |
int z; | |
}; |
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
void setup(){ | |
size(350, 350); | |
background(255,255,255); | |
textSize(26); | |
} | |
void arrow(int x1, int y1, float x2, float y2) { | |
line(x1, y1, x2, y2); | |
pushMatrix(); | |
translate(x2, y2); | |
float a = atan2(x1-x2, y2-y1); |
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
from math import sqrt | |
N = 1997 | |
A = 59 | |
B = 23 | |
coords = [] | |
for x in range(N): | |
temp = (pow(x, 3, N) + A*x + B) % N | |
while (temp < 0): | |
temp += N | |
for i in range(N): |
OlderNewer