buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
import java.util.Scanner; public class Main { public static void main(String[] args) { int n; Scanner s = new Scanner(System.in); n = s.nextInt(); System.out.println(0.0 + " " + 0.0); koch(0.0, 0.0, 100.0, 0.0, 1, n); System.out.println(100.0 + " " + 0.0); } static void koch(double ax, ...
import java.util.Scanner; public class Main { public static void main(String[] args) { int n; Scanner s = new Scanner(System.in); n = s.nextInt(); System.out.println(0.0 + " " + 0.0); koch(0.0, 0.0, 100.0, 0.0, 0, n); System.out.println(100.0 + " " + 0.0); } static void koch(double ax, ...
[["-", 8, 196, 0, 1, 0, 492, 3, 4, 0, 499], ["+", 8, 196, 0, 1, 0, 492, 3, 4, 0, 499]]
3
378
2
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); koch(0, 0, 100, 0, 0, n); System.out.format("%.4f %.4f\n", (double)100, (double)0); sc.close(); } public static void koch(double x1, double y1...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); koch(0, 0, 100, 0, 0, n); System.out.format("%.4f %.4f\n", (double)100, (double)0); sc.close(); } public static void koch(double x1, double y1...
[["-", 75, 196, 0, 503, 49, 200, 51, 16, 12, 22], ["+", 75, 196, 0, 503, 49, 200, 51, 16, 12, 22]]
3
347
4
#include <math.h> #include <stdio.h> struct Point { double x, y; }; void koch(int n, struct Point a, struct Point b) { if (n == 0) return; struct Point s, t, u; double th = M_PI * 60.0 / 180.0; // 度からラジアンへ単位を変換 s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3.0; t.x = (1.0 * a...
#include <math.h> #include <stdio.h> struct Point { double x, y; }; void koch(int n, struct Point a, struct Point b) { if (n == 0) return; struct Point s, t, u; double th = M_PI * 60.0 / 180.0; // 度からラジアンへ単位を変換 s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3.0; t.x = (1.0 * a...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
397
2
#include <math.h> #include <stdio.h> #define pie 3.1415926535897 void koch(int n, double p1x, double p1y, double p2x, double p2y) { double sx, sy, tx, ty, ux, uy, th; if (n == 0) return; th = pie * 60.0 / 180.0; sx = (p1x * 2.0 + p2x * 1.0) / 3.0; sy = (p1y * 2.0 + p2y * 1.0) / 3.0; tx = (p1x * 1.0 + p...
#include <math.h> #include <stdio.h> #define pie 3.1415926535897 void koch(int n, double p1x, double p1y, double p2x, double p2y) { double sx, sy, tx, ty, ux, uy, th; if (n == 0) return; th = pie * 60.0 / 180.0; sx = (p1x * 2.0 + p2x * 1.0) / 3.0; sy = (p1y * 2.0 + p2y * 1.0) / 3.0; tx = (p1x * 1.0 + p...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
0
345
4
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } vertex; void kock(int, vertex, vertex); int main() { int n; vertex p1 = {0, 0}, p2 = {100, 0}; scanf("%d", &n); if (n > 6 || n < 0) return 0; printf("%.8lf %.8lf\n", p1.x, p1.y); kock(n, p1, p2); printf("%.8lf %.8l...
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } vertex; void kock(int, vertex, vertex); int main() { int n; vertex p1 = {0, 0}, p2 = {100, 0}; scanf("%d", &n); if (n > 6 || n < 0) return 0; printf("%.8lf %.8lf\n", p1.x, p1.y); kock(n, p1, p2); printf("%.8lf %.8l...
[["-", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
404
6
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } dot; void kock(int, dot, dot); void kock(int n, dot p1, dot p2) { dot s, t, u; if (n == 0) return; s.x = (2 * p1.x + 1 * p2.x) / 3; s.y = (2 * p1.y + 1 * p2.y) / 3; t.x = (1 * p1.x + 2 * p2.x) / 3; t.y = (1 * p1.y + 2 ...
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } dot; void kock(int, dot, dot); void kock(int n, dot p1, dot p2) { dot s, t, u; if (n == 0) return; s.x = (2 * p1.x + 1 * p2.x) / 3; s.y = (2 * p1.y + 1 * p2.y) / 3; t.x = (1 * p1.x + 2 * p2.x) / 3; t.y = (1 * p1.y + 2 ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
394
2
#include <math.h> #include <stdio.h> typedef struct Point { double x; double y; } P; void koch(int n, P a, P b) { if (n == 0) return; P s, t, u; double th = M_PI * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3.0; t.x = (1.0 * a.x + 2.0 * b.x) / 3.0; t.y = ...
#include <math.h> #include <stdio.h> typedef struct Point { double x; double y; } P; void koch(int n, P a, P b) { if (n == 0) return; P s, t, u; double th = M_PI * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3.0; t.x = (1.0 * a.x + 2.0 * b.x) / 3.0; t.y = ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
395
2
#include <math.h> #include <stdio.h> int n; void kock(double lpx, double lpy, double rpx, double rpy, int n) { if (n == 0) return; double sx, sy, tx, ty, ux, uy; double ag = M_PI / 180; sx = (2 * lpx + rpx) / 3, sy = (2 * lpy + rpy) / 3; tx = (lpx + 2 * rpx) / 3, ty = (lpy + 2 * rpy) / 3; ux = (tx - ...
#include <math.h> #include <stdio.h> int n; void kock(double lpx, double lpy, double rpx, double rpy, int n) { if (n == 0) return; double sx, sy, tx, ty, ux, uy; double ag = M_PI / 180; sx = (2 * lpx + rpx) / 3, sy = (2 * lpy + rpy) / 3; tx = (lpx + 2 * rpx) / 3, ty = (lpy + 2 * rpy) / 3; ux = (tx - ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
333
2
#include <math.h> #include <stdio.h> typedef struct { double x, y; } zahyo; void koch(int, zahyo, zahyo); int main() { zahyo a, b; int n; scanf("%d", &n); a.x = 0; a.y = 0; b.x = 100; b.y = 0; printf("%.8f%.8f\n", a.x, a.y); koch(n, a, b); printf("%.8f %.8f\n", b.x, b.y); return 0; } void koch(...
#include <math.h> #include <stdio.h> typedef struct { double x, y; } zahyo; void koch(int, zahyo, zahyo); int main() { zahyo a, b; int n; scanf("%d", &n); a.x = 0; a.y = 0; b.x = 100; b.y = 0; printf("%.8f %.8f\n", a.x, a.y); koch(n, a, b); printf("%.8f %.8f\n", b.x, b.y); return 0; } void koch(...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
403
2
#include <math.h> #include <stdio.h> #define PI M_PI typedef struct point { double x; double y; } P; void Kock(P f, P l, int n) { double theta = PI / 3.0; P s, u, t; if (n == 0) return; s.x = (2 * f.x + l.x) / 3; s.y = (2 * f.y + l.y) / 3; t.x = (f.x + 2 * l.x) / 3; t.y = (f.y + 2 * l.x) / 3; u...
#include <math.h> #include <stdio.h> #define PI M_PI typedef struct { double x; double y; } P; void Kock(P f, P l, int n) { double theta = PI / 3.0; P s, u, t; if (n == 0) return; s.x = (2 * f.x + l.x) / 3; s.y = (2 * f.y + l.y) / 3; t.x = (f.x + 2 * l.x) / 3; t.y = (f.y + 2 * l.y) / 3; u.x = (...
[["-", 36, 36, 0, 30, 0, 134, 39, 122, 141, 78], ["-", 31, 23, 0, 16, 12, 16, 12, 118, 119, 120], ["+", 31, 23, 0, 16, 12, 16, 12, 118, 119, 120]]
0
376
3
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } P; void kock(int, P, P); int main() { int n; P p1 = {0.0, 0.0}, p2 = {100.0, 0.0}; scanf("%d", &n); printf("%f %f\n", p1.x, p1.y); kock(n, p1, p2); printf("%f %f\n", p2.x, p2.y); return 0; } void kock(int n, P p1, P ...
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } P; void kock(int, P, P); int main() { int n; P p1 = {0.0, 0.0}, p2 = {100.0, 0.0}; scanf("%d", &n); printf("%f %f\n", p1.x, p1.y); kock(n, p1, p2); printf("%f %f\n", p2.x, p2.y); return 0; } void kock(int n, P p1, P ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
383
2
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } point_t; void kock(int n, point_t ps, point_t pe) { if (n == 0) return; // (n:+p:p) = 0:0:2, 1:3:5, 2:12:17, 3:48:65 // +p(n) = (p(n-1) - 1) * 3 // p(n) = +p(n) + p(n-1) // calculate {s, t, u} double rad = 60 * M_PI / 18...
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } point_t; void kock(int n, point_t ps, point_t pe) { if (n == 0) return; // (n:+p:p) = 0:0:2, 1:3:5, 2:12:17, 3:48:65 // +p(n) = (p(n-1) - 1) * 3 // p(n) = +p(n) + p(n-1) // calculate {s, t, u} double rad = 60 * M_PI / 18...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
387
10
#include <math.h> #include <stdio.h> typedef struct endPoint { double x; double y; } endpoint; void kock(int, endpoint, endpoint); int main() { int n; endpoint p1, p2; p1.x = 0.0; p1.y = 0.0; p2.x = 100.0; p2.y = 0.0; scanf("%d", &n); printf("%.8f %.8f\n", p1.x, p1.y); kock(n, p1, p2); ...
#include <math.h> #include <stdio.h> typedef struct endPoint { double x; double y; } endpoint; void kock(int, endpoint, endpoint); int main() { int n; endpoint p1, p2; p1.x = 0.0; p1.y = 0.0; p2.x = 100.0; p2.y = 0.0; scanf("%d", &n); printf("%.8f %.8f\n", p1.x, p1.y); kock(n, p1, p2); ...
[["+", 12, 16, 12, 2, 3, 4, 0, 16, 17, 85], ["+", 12, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
0
402
2
#include <math.h> #include <stdio.h> #define N 6 typedef struct { double x; double y; } XY; void koch(int, XY, XY); int main() { int n, i; XY p1 = {0.0, 0.0}, p2 = {100.0, 0.0}; scanf("%d", &n); printf("%.8f %.8f\n", p1.x, p1.y); koch(n, p1, p2); printf("%.8f %.8f\n", p2.x, p2.y); return 0; } vo...
#include <math.h> #include <stdio.h> #define N 6 typedef struct { double x; double y; } XY; void koch(int, XY, XY); int main() { int n, i; XY p1 = {0.0, 0.0}, p2 = {100.0, 0.0}; scanf("%d", &n); printf("%.8f %.8f\n", p1.x, p1.y); koch(n, p1, p2); printf("%.8f %.8f\n", p2.x, p2.y); return 0; } vo...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33]]
0
390
2
#include <math.h> #include <stdio.h> typedef struct { double x, y; } Point; int koch(int n, Point p1, Point p2) { Point s, t, u; double degree = M_PI / 3; if (n == 0) return; s.x = (2 * p1.x + 1 * p2.x) / 3; s.y = (2 * p1.y + 1 * p2.y) / 3; t.x = (1 * p1.x + 2 * p2.x) / 3; t.y = (1 * p1.y + 2 * p2...
#include <math.h> #include <stdio.h> typedef struct { double x, y; } Point; int koch(int n, Point p1, Point p2) { Point s, t, u; double degree = M_PI / 3; if (n == 0) return; s.x = (2 * p1.x + 1 * p2.x) / 3; s.y = (2 * p1.y + 1 * p2.y) / 3; t.x = (1 * p1.x + 2 * p2.x) / 3; t.y = (1 * p1.y + 2 * p2...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
388
3
#include <math.h> #include <stdio.h> #define PI 3.141592 void koch(int n, double p1x, double p1y, double p2x, double p2y) { if (!n) return; double sx, sy, tx, ty, ux, uy; sx = (2 * p1x + p2x) / 3; sy = (2 * p1y + p2y) / 3; tx = (p1x + 2 * p2x) / 3; ty = (p1y + 2 * p2y) / 3; ux = (tx - sx) * cos(PI ...
#include <math.h> #include <stdio.h> #define PI 3.141592653 void koch(int n, double p1x, double p1y, double p2x, double p2y) { if (!n) return; double sx, sy, tx, ty, ux, uy; sx = (2 * p1x + p2x) / 3; sy = (2 * p1y + p2y) / 3; tx = (p1x + 2 * p2x) / 3; ty = (p1y + 2 * p2y) / 3; ux = (tx - sx) * cos(...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
0
310
4
#include <math.h> #include <stdio.h> #define PI 3.14159265359 int n = 0; typedef struct { double x; double y; } point; void kock(int, point, point); point p1 = {0, 0}; point p2 = {100, 0}; int main() { scanf("%d", &n); printf("%.8f %.8f\n", p1.x, p1.y); kock(n, p1, p2); printf("%.8f %.8f\n", p2.x, p2.y)...
#include <math.h> #include <stdio.h> #define PI 3.14159265359 int n = 0; typedef struct { double x; double y; } point; void kock(int, point, point); point p1 = {0, 0}; point p2 = {100, 0}; int main() { scanf("%d", &n); printf("%.8f %.8f\n", p1.x, p1.y); kock(n, p1, p2); printf("%.8f %.8f\n", p2.x, p2.y)...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
431
6
#include <math.h> #include <stdio.h> typedef struct xy { double x; double y; } XY; void cohho(int n, XY head, XY tail) { if (n == 0) return; double th = M_PI * 60.0 / 180.0; XY s, t, u; s.x = (2.0 * head.x + tail.x) / 3.0; s.y = (2.0 * head.y + tail.y) / 3.0; t.x = (head.x + 2.0 * tail.x) / 3.0;...
#include <math.h> #include <stdio.h> typedef struct xy { double x; double y; } XY; void cohho(int n, XY head, XY tail) { if (n == 0) return; double th = M_PI * 60.0 / 180.0; XY s, t, u; s.x = (2.0 * head.x + tail.x) / 3.0; s.y = (2.0 * head.y + tail.y) / 3.0; t.x = (head.x + 2.0 * tail.x) / 3.0;...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
387
2
#include <math.h> #include <stdio.h> typedef struct { double x, y; } Point; void koch(int, Point, Point); int main() { Point a, b; int n; scanf("%d", &n); a.x = 0; a.y = 0; b.x = 100; b.y = 0; printf("%.8f %.8f\n", a.x, a.y); koch(n, a, b); printf("%.8f %.8f\n", b.x, b.y); return 0; } voi...
#include <math.h> #include <stdio.h> typedef struct { double x, y; } Point; void koch(int, Point, Point); int main() { Point a, b; int n; scanf("%d", &n); a.x = 0; a.y = 0; b.x = 100; b.y = 0; printf("%.8f %.8f\n", a.x, a.y); koch(n, a, b); printf("%.8f %.8f\n", b.x, b.y); return 0; } voi...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
405
2
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <math.h> #include <stdio.h> #define rad(i) (i / 180) * M_PI typedef struct { double x; double y; } koch; int KochCurve(int, koch, koch); int main() { int n; koch p1, p2; p1.x = p1.y = p2.y = 0.0; p2.x = 100.0; scanf("%d", &n); printf("...
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <math.h> #include <stdio.h> #define rad(i) (i / 180) * M_PI typedef struct { double x; double y; } koch; int KochCurve(int, koch, koch); int main() { int n; koch p1, p2; p1.x = p1.y = p2.y = 0.0; p2.x = 100.0; scanf("%d", &n); printf("...
[["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
415
4
#include <math.h> #include <stdio.h> #define M_PI 3.14159265358979 void koch(int n, double ax, double ay, double bx, double by) { int sx, sy, tx, ty, ux, uy; double th = M_PI * 60.0 / 180.0; if (n == 0) { return; } sx = (2.0 * ax + 1.0 * bx) / 3.0; sy = (2.0 * ay + 1.0 * by) / 3.0; tx = (1.0 * ax ...
#include <math.h> #include <stdio.h> #define M_PI 3.14159265358979 void koch(int n, double ax, double ay, double bx, double by) { double sx, sy, tx, ty, ux, uy; double th = M_PI * 60.0 / 180.0; if (n == 0) { return; } sx = (2.0 * ax + 1.0 * bx) / 3.0; sy = (2.0 * ay + 1.0 * by) / 3.0; tx = (1.0 * ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
0
347
2
#include <math.h> #include <stdio.h> struct point { double x, y; }; void koch(int n, struct point a, struct point b) { if (n == 0) { return; } struct point s, t, u; double th = 3.14 * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3.0; t.x = (1.0 * a.x + 2.0 * ...
#include <math.h> #include <stdio.h> struct point { double x, y; }; void koch(int n, struct point a, struct point b) { if (n == 0) { return; } struct point s, t, u; double th = 3.14159265 * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3.0; t.x = (1.0 * a.x + ...
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 31, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 31, 13]]
0
398
2
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } Point; void koch(int, Point, Point); int main(int argc, char const *argv[]) { Point a, b; // a(0,0) b(100,0)?????? int n; scanf("%d", &n); a.x = 0; a.y = 0; b.x = 100; b.y = 0; printf("%.8f %.8f\n", a.x, a.y); koch(...
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } Point; void koch(int, Point, Point); int main(int argc, char const *argv[]) { Point a, b; // a(0,0) b(100,0)?????? int n; scanf("%d", &n); a.x = 0; a.y = 0; b.x = 100; b.y = 0; printf("%.8f %.8f\n", a.x, a.y); koch(...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
416
2
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } Point; void koch(int n, Point a, Point b) { if (n == 0) return; Point s, t, u; s.x = (2 * a.x + b.x) / 3; s.y = (2 * a.y + b.y) / 3; t.x = (a.x + 2 * b.x) / 3; t.y = (a.y + 2 * b.y) / 3; u.x = (t.x - s.x) / 2 - (t.y - s...
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } Point; void koch(int n, Point a, Point b) { if (n == 0) return; Point s, t, u; s.x = (2 * a.x + b.x) / 3; s.y = (2 * a.y + b.y) / 3; t.x = (a.x + 2 * b.x) / 3; t.y = (a.y + 2 * b.y) / 3; u.x = (t.x - s.x) / 2 - (t.y - s...
[["-", 0, 1, 0, 11, 12, 16, 12, 118, 119, 120], ["+", 0, 1, 0, 11, 12, 16, 12, 118, 119, 120]]
0
379
2
#include <math.h> #include <stdio.h> void kock(int n, double x1, double y1, double x2, double y2) { double sx, sy, ux, uy, tx, ty; if (n != 0) { sx = (2 * x1 + x2) / 3; sy = (2 * y1 + y2) / 3; tx = (x1 + 2 * x2) / 3; ty = (x1 + 2 * y2) / 3; ux = ((tx - sx) * cos(M_PI / 3) - (ty - sy) * sin(M_P...
#include <math.h> #include <stdio.h> void kock(int n, double x1, double y1, double x2, double y2) { double sx, sy, ux, uy, tx, ty; if (n != 0) { sx = (2 * x1 + x2) / 3; sy = (2 * y1 + y2) / 3; tx = (x1 + 2 * x2) / 3; ty = (y1 + 2 * y2) / 3; ux = ((tx - sx) * cos(M_PI / 3) - (ty - sy) * sin(M_P...
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22]]
0
331
2
#include <math.h> #include <stdio.h> typedef struct zahyou { double x; double y; } P; void kock(int, P, P); P p1, p2; int main() { int n; p1.x = 0; p1.y = 0; p2.x = 100; p2.y = 0; scanf("%d", &n); printf("%f %f\n", p1.x, p1.y); kock(n, p1, p2); printf("%f %f\n", p2.x, p2.y); return 0;...
#include <math.h> #include <stdio.h> typedef struct zahyou { double x; double y; } P; void kock(int, P, P); P p1, p2; int main() { int n; p1.x = 0; p1.y = 0; p2.x = 100; p2.y = 0; scanf("%d", &n); printf("%f %f\n", p1.x, p1.y); kock(n, p1, p2); printf("%f %f\n", p2.x, p2.y); return 0;...
[["-", 12, 16, 31, 23, 0, 16, 31, 118, 119, 120], ["+", 12, 16, 31, 23, 0, 16, 31, 118, 119, 120]]
0
396
2
#include <math.h> #include <stdio.h> #define PI 3.14159265 typedef struct point { double x; double y; } Point; /* Prototype Declaration */ void kock(int, Point, Point); int main() { int n; Point p1, p2; scanf("%d", &n); p1.x = 0.0; p1.y = 0.0; p2.x = 100.0; p2.y = 0.0; printf("%.8f %.8f\n", p...
#include <math.h> #include <stdio.h> #define PI 3.141592653 typedef struct point { double x; double y; } Point; /* Prototype Declaration */ void kock(int, Point, Point); int main() { int n; Point p1, p2; scanf("%d", &n); p1.x = 0.0; p1.y = 0.0; p2.x = 100.0; p2.y = 0.0; printf("%.8f %.8f\n", ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
400
4
#include <stdio.h> typedef struct { double x, y; } Point; void kock(int, Point, Point); int main() { int n; Point p1, p2; p1.x = 0; p1.y = 0; p2.x = 100; p2.y = 0; scanf("%d", &n); printf("%.8f %.8f\n", p1.x, p1.y); kock(n, p1, p2); printf("%.8f %.8f\n", p2.x, p2.y); return 0; } void k...
#include <stdio.h> typedef struct { double x, y; } Point; void kock(int, Point, Point); int main() { int n; Point p1, p2; p1.x = 0; p1.y = 0; p2.x = 100; p2.y = 0; scanf("%d", &n); printf("%.8f %.8f\n", p1.x, p1.y); kock(n, p1, p2); printf("%.8f %.8f\n", p2.x, p2.y); return 0; } void k...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
0
390
2
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } Point; void koch(int n, Point a, Point b) { double rad; Point s, t, u; if (n == 0) return; rad = M_PI * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3, 0; t.x = (1.0 * a.x + 2.0 * b...
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } Point; void koch(int n, Point a, Point b) { double rad; Point s, t, u; if (n == 0) return; rad = M_PI * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3, 0; t.x = (1.0 * a.x + 2.0 * b...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
398
2
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } Point; #define PI 3.141592 void kock(int n, Point p1, Point p2) { Point s, t, u; if (n == 0) { return; } s.x = (2 * p1.x + p2.x) / 3; s.y = (2 * p1.y + p2.y) / 3; t.x = (p1.x + 2 * p2.x) / 3; t.y = (p1.y + 2 * p2.y) / 3; ...
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } Point; #define PI 3.141592 void kock(int n, Point p1, Point p2) { Point s, t, u; if (n == 0) { return; } s.x = (2 * p1.x + p2.x) / 3; s.y = (2 * p1.y + p2.y) / 3; t.x = (p1.x + 2 * p2.x) / 3; t.y = (p1.y + 2 * p2.y) / 3; ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
398
4
#include <math.h> #include <stdio.h> struct Point { double x; double y; }; void koch(int, struct Point, struct Point); int main() { struct Point a, b; int n; scanf("%d", &n); a.x = 0; a.y = 0; b.x = 100; b.y = 0; printf("%.8f %.8f\n", a.x, a.y); koch(n, a, b); printf("%.8f %.8f\n", b.x, b.y); ...
#include <math.h> #include <stdio.h> struct Point { double x; double y; }; void koch(int, struct Point, struct Point); int main() { struct Point a, b; int n; scanf("%d", &n); a.x = 0; a.y = 0; b.x = 100; b.y = 0; printf("%.8f %.8f\n", a.x, a.y); koch(n, a, b); printf("%.8f %.8f\n", b.x, b.y); ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
411
2
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } Point; void kock(int n, Point p1, Point p2) { Point s, t, u; if (n == 0) return; s.x = (2 * p1.x + 1 * p2.x) / 3.0; s.y = (2 * p1.y + 1 * p2.y) / 3.0; t.x = (1 * p1.x + 2 * p2.x) / 3.0; t.y = (1 * p1.y + 2 * p2.y) / 3.0...
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } Point; void kock(int n, Point p1, Point p2) { Point s, t, u; if (n == 0) return; s.x = (2 * p1.x + 1 * p2.x) / 3.0; s.y = (2 * p1.y + 1 * p2.y) / 3.0; t.x = (1 * p1.x + 2 * p2.x) / 3.0; t.y = (1 * p1.y + 2 * p2.y) / 3.0...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33]]
0
401
2
#include <math.h> #include <stdio.h> #include <stdlib.h> #define PI 3.1415926535 typedef struct { double x; double y; } Point; void KochCurve(Point, Point, int); int main(void) { int n; Point p1 = {0, 0}; Point p2 = {100, 0}; scanf("%d", &n); printf("%.8f %.8f\n", p1.x, p1.y); KochCurve(p1, p2, n)...
#include <math.h> #include <stdio.h> #include <stdlib.h> #define PI 3.1415926535 typedef struct { double x; double y; } Point; void KochCurve(Point, Point, int); int main(void) { int n; Point p1 = {0, 0}; Point p2 = {100, 0}; scanf("%d", &n); printf("%.8f %.8f\n", p1.x, p1.y); KochCurve(p1, p2, n)...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
392
2
#include <iostream> using namespace std; void merge(int A[], int n, int left, int mid, int right, int &ans) { int *tmp = new int[n]; for (int i = left; i < mid + 1; ++i) { tmp[i] = A[i]; } for (int j = mid + 1, i = right; i <= right; --j, ++i) { tmp[i] = A[j]; } int i = left; int j = right; ...
#include <iostream> using namespace std; void merge(int A[], int n, int left, int mid, int right, int &ans) { int *tmp = new int[n]; for (int i = left; i <= mid; ++i) { tmp[i] = A[i]; } for (int i = mid + 1, j = right; i <= right; --j, ++i) { tmp[i] = A[j]; } int i = left; int j = right; for...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22]]
1
375
8
#include <bits/stdc++.h> using namespace std; #define INF 1 << 20 void divide_list(int, int); void marge(int, int, int); int v[5000000]; int c; int main(void) { int num; cin >> num; for (int i = 0; i < num; i++) { cin >> v[i]; } divide_list(num, 0); for (int i = 0; i < num; i++) { if (i) cout ...
#include <bits/stdc++.h> using namespace std; #define INF 1 << 30 void divide_list(int, int); void marge(int, int, int); int v[5000000]; int c; int main(void) { int num; cin >> num; for (int i = 0; i < num; i++) { cin >> v[i]; } divide_list(num, 0); for (int i = 0; i < num; i++) { if (i) cout ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
355
6
#include <climits> #include <iostream> #include <vector> using namespace std; void fnInput(int &rnMaxSiz, vector<int> &rvnSort) { cin >> rnMaxSiz; rvnSort.resize(rnMaxSiz); for (int i = 0; i < rnMaxSiz; i++) cin >> rvnSort[i]; } void fnMerge(vector<int> &rvnSort, int &rnSortCnt, int nLeft, int nMid, ...
#include <climits> #include <iostream> #include <vector> using namespace std; void fnInput(int &rnMaxSiz, vector<int> &rvnSort) { cin >> rnMaxSiz; rvnSort.resize(rnMaxSiz); for (int i = 0; i < rnMaxSiz; i++) cin >> rvnSort[i]; } void fnMerge(vector<int> &rvnSort, int &rnSortCnt, int nLeft, int nMid, ...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
465
2
#include <cstdio> #include <queue> using namespace std; int n, c, v, dp[500007]; int main() { scanf("%d", &n); dp[n] = 1; for (int i = (n + 2) / 2; i > 1; i--) dp[i] = dp[2 * i - 1] + 2 * dp[2 * i] + dp[2 * i + 1]; for (int i = 2; i <= n; i++) c += dp[i] * i; priority_queue<int> que; for (int i = 0;...
#include <cstdio> #include <queue> using namespace std; int n, c, v, dp[500007]; int main() { scanf("%d", &n); dp[n] = 1; for (int i = (n + 2) / 2; i > 1; i--) dp[i] = dp[2 * i - 1] + 2 * dp[2 * i] + dp[2 * i + 1]; for (int i = 2; i <= n; i++) c += dp[i] * i; priority_queue<int> que; for (int i = 0;...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 91, 17, 33]]
1
217
2
#include <iostream> #define INF 1000000000 using namespace std; int cnt = 0; void merge(int a[], int left, int mid, int right); void mergeSort(int a[], int left, int right); int main() { int i, n, a[500000]; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; mergeSort(a, 0, n - 1); for (i = 0; i < n; i++) {...
#include <iostream> #define INF 1000000000 using namespace std; int cnt = 0; void merge(int a[], int left, int mid, int right); void mergeSort(int a[], int left, int right); int main() { int i, n, a[500001]; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; mergeSort(a, 0, n); for (i = 0; i < n; i++) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
403
4
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*- // ALDS1_5-B: Merge Sort #include <climits> #include <cstdio> #include <cstring> static void print_ints(const int as[], const unsigned int n, const char *sep = " ") { const char *out_sep = ""; for (auto i = 0u; i < n; ++i) { std::prin...
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*- // ALDS1_5-B: Merge Sort #include <climits> #include <cstdio> #include <cstring> static void print_ints(const int as[], const unsigned int n, const char *sep = " ") { const char *out_sep = ""; for (auto i = 0u; i < n; ++i) { std::prin...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18]]
1
452
2
#include "iostream" using namespace std; int c; void marge(int s[50000], int head, int mid, int tail) { int x[50000]; int m = mid; for (int i = head; i < tail; i++) { x[i] = s[i]; } for (int i = head; i < tail; i++) { if (mid == tail) { s[i] = x[head]; head++; } else if (head == ...
#include "iostream" using namespace std; int c; void marge(int s[500000], int head, int mid, int tail) { int x[500000]; int m = mid; for (int i = head; i < tail; i++) { x[i] = s[i]; } for (int i = head; i < tail; i++) { if (mid == tail) { s[i] = x[head]; head++; } else if (head =...
[["-", 49, 53, 54, 55, 0, 56, 49, 80, 81, 13], ["+", 49, 53, 54, 55, 0, 56, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19]]
1
346
10
#include <iostream> #include <vector> #define INF 2000000000 using namespace std; int c = 0; vector<int> merge(vector<int> A, vector<int> B) { vector<int> res; int i = 0, j = 0; while (i < (int)A.size() || j < (int)B.size()) { if (i < (int)A.size() && j < (int)B.size()) { if (A[i] <= B[j]) res.p...
#include <iostream> #include <vector> using namespace std; int c = 0; vector<int> merge(vector<int> A, vector<int> B) { vector<int> res; int i = 0, j = 0; while (i < (int)A.size() || j < (int)B.size()) { if (i < (int)A.size() && j < (int)B.size()) { if (A[i] <= B[j]) res.push_back(A[i++]); ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
420
5
#include <algorithm> #include <cstdio> #include <vector> using namespace std; const int INF = 1 << 31; template <class RandomIt> size_t msort(RandomIt first, RandomIt last) { if (first + 1 >= last) return 0; using T = typename RandomIt::value_type; ptrdiff_t lhalf = (last - first) >> 1; RandomIt mid = f...
#include <algorithm> #include <cstdio> #include <vector> using namespace std; const int INF = 1 << 30; template <class RandomIt> size_t msort(RandomIt first, RandomIt last) { if (first + 1 >= last) return 0; using T = typename RandomIt::value_type; ptrdiff_t lhalf = (last - first) >> 1; RandomIt mid = f...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13]]
1
375
2
#include <algorithm> #include <cstdio> #include <vector> using namespace std; const int INF = 1 << 30; template <class RandomIt> size_t msort(RandomIt first, RandomIt last) { if (first + 1 >= last) return 0; using T = typename RandomIt::value_type; ptrdiff_t lhalf = (last - first) >> 1; RandomIt mid = f...
#include <algorithm> #include <cstdio> #include <vector> using namespace std; const int INF = 1 << 30; template <class RandomIt> size_t msort(RandomIt first, RandomIt last) { if (first + 1 >= last) return 0; using T = typename RandomIt::value_type; ptrdiff_t lhalf = (last - first) >> 1; RandomIt mid = f...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22]]
1
393
2
#include <iostream> #include <vector> int __counter__ = 0; namespace std { void trace(vector<int> v) { for (int i = 0; i < v.size(); ++i) { if (i != v.size() - 1) cout << v[i] << " "; else cout << v[i] << endl; } cout << endl; } void merge(vector<int> &v, vector<int> &L, vector<int> &R) ...
#include <iostream> #include <vector> int __counter__ = 0; namespace std { void trace(vector<int> v) { for (int i = 0; i < v.size(); ++i) { if (i != v.size() - 1) cout << v[i] << " "; else cout << v[i] << endl; } } void merge(vector<int> &v, vector<int> &L, vector<int> &R) { vector<int>:...
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 201, 0, 14, 8, 9, 0, 1, 0, 35]]
1
395
4
#include <algorithm> #include <iostream> #include <stack> #include <stdio.h> #include <string> using namespace std; int merges(int start, int end) { int middle; if (start + 1 < end) { middle = (start + end) / 2; return (merges(start, middle) + merges(middle, end) - start + end); } else { return 0; ...
#include <algorithm> #include <iostream> #include <stack> #include <stdio.h> #include <string> using namespace std; int merges(int start, int end) { int middle; if (start + 1 < end) { middle = (start + end) / 2; return (merges(start, middle) + merges(middle, end) - start + end); } else { return 0; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
178
2
#include <iostream> using namespace std; class Merge { public: Merge() : count(0) {} void mergeSort(int A[], int left, int right) { if (left + 1 >= right) { return; } int mid = (left + right) / 2; mergeSort(A, left, mid); mergeSort(A, mid, right); merge(A, left, mid, right); } i...
#include <iostream> using namespace std; class Merge { public: Merge() : count(0) {} void mergeSort(int A[], int left, int right) { if (left + 1 >= right) { return; } int mid = (left + right) / 2; mergeSort(A, left, mid); mergeSort(A, mid, right); merge(A, left, mid, right); } i...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
400
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 500000; int cnt; int A[MAXN], L[MAXN / 2 + 5], R[MAXN / 2 + 5]; void merge(int left, int mid, int right) { int n1 = mid - left, n2 = rig...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 500000; int cnt; int A[MAXN], L[MAXN / 2 + 5], R[MAXN / 2 + 5]; void merge(int left, int mid, int right) { int n1 = mid - left, n2 = rig...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
361
3
// ?????¬???????????¬?????? #include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <ma...
// ?????¬???????????¬?????? #include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <ma...
[["-", 0, 16, 12, 23, 0, 41, 15, 16, 12, 13], ["+", 12, 23, 0, 41, 15, 16, 12, 16, 31, 22], ["+", 12, 23, 0, 41, 15, 16, 12, 16, 17, 33], ["+", 12, 23, 0, 41, 15, 16, 12, 16, 12, 13]]
1
522
4
#include <climits> #include <iostream> #define INF INT_MAX; void merge(int *, int, int, int); void mergeSort(int *, int, int); int cnt = 0; int main() { int n; std::cin >> n; int A[n]; for (int i = 0; i < n; i++) std::cin >> A[i]; mergeSort(A, 0, n); for (int i = 0; i < n; i++) std::cout << A[i] << ...
#include <climits> #include <iostream> #define INF INT_MAX; void merge(int *, int, int, int); void mergeSort(int *, int, int); int cnt = 0; int main() { int n; std::cin >> n; int A[n]; for (int i = 0; i < n; i++) std::cin >> A[i]; mergeSort(A, 0, n); for (int i = 0; i < n; i++) std::cout << A[i] << ...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 1, 0, 34, 0, 42, 0, 101], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 12, 34, 31, 11, 31, 69, 0, 42, 0, 102], ["+", 0, 7, 8, 9, 0, 57, 64, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 8, 9, 0, 57, 64, 9, 0...
1
383
9
#include <iostream> #include <limits> #define INFTY 1000000000 using namespace std; int n; int cnt = 0; void printArray(int *A) { for (int i = 0; i < n; i++) { cout << A[i]; if (i < n - 1) cout << " "; } cout << endl; } void merge(int *A, int left, int mid, int right) { int n1 = mid - left; ...
#include <iostream> #include <limits> #define INFTY 1000000000 using namespace std; int n; int cnt = 0; void printArray(int *A) { for (int i = 0; i < n; i++) { cout << A[i]; if (i < n - 1) cout << " "; } cout << endl; } void merge(int *A, int left, int mid, int right) { int n1 = mid - left; ...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
376
5
/* * ALDS1_5_B.cpp * * Created on: Apr 27, 2018 * Author: 13743 */ #include <cstdio> using namespace std; int cnt = 0; void merge(int *A, int l, int mid, int r) { int n1 = mid - l; int n2 = r - mid; int L[n1 + 1]; int R[n2 + 1]; for (int i = 0; i < n1; i++) { L[i] = A[l + i]; } for (int...
/* * ALDS1_5_B.cpp * * Created on: Apr 27, 2018 * Author: 13743 */ #include <cstdio> using namespace std; int cnt = 0; void merge(int *A, int l, int mid, int r) { int n1 = mid - l; int n2 = r - mid; int L[n1 + 1]; int R[n2 + 1]; for (int i = 0; i < n1; i++) { L[i] = A[l + i]; } for (int...
[["+", 8, 9, 0, 7, 15, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
384
3
#include <iostream> using namespace std; #define INF 2 << 32; int S[500000]; int merge(int left, int mid, int right) { int count = 0; int n1 = mid - left; int n2 = right - mid; int L[n1 + 1], R[n2 + 1]; for (int i = 0; i < n1; i++) { L[i] = S[left + i]; } for (int i = 0; i < n2; i++) { R[i] = S[mi...
#include <iostream> using namespace std; #define INF 2 << 29; int S[500000]; int merge(int left, int mid, int right) { int count = 0; int n1 = mid - left; int n2 = right - mid; int L[n1 + 1], R[n2 + 1]; for (int i = 0; i < n1; i++) { L[i] = S[left + i]; } for (int i = 0; i < n2; i++) { R[i] = S[mi...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
372
2
#include <cmath> #include <iostream> using namespace std; int count = 0; void merge(int *A, int left, int mid, int right) { int n1 = mid - left; int n2 = right - mid; int L[n1 + 1]; int R[n2 + 1]; for (int i = 0; i < n1; i++) { L[i] = A[left + i]; } for (int i = 0; i < n2; i++) { R[i] = A[mid + i...
#include <cmath> #include <iostream> using namespace std; int count = 0; void merge(int *A, int left, int mid, int right) { int n1 = mid - left; int n2 = right - mid; int L[n1 + 1]; int R[n2 + 1]; for (int i = 0; i < n1; i++) { L[i] = A[left + i]; } for (int i = 0; i < n2; i++) { R[i] = A[mid + i...
[["+", 64, 9, 0, 1, 0, 16, 12, 69, 28, 22], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 73]]
1
374
3
#include <iostream> using namespace std; #define MAX 500000 #define SENTINEL 2000000000 int L[MAX / 2 + 2], R[MAX / 2 + 2]; int cnt; void merge(int A[], int left, int right, int mid) { for (int i = 0; i < mid - left; i++) L[i] = A[left + i]; for (int i = 0; i < right - mid; i++) R[i] = A[mid + i]; L[mid ...
#include <iostream> using namespace std; #define MAX 500000 #define SENTINEL 2000000000 int L[MAX / 2 + 2], R[MAX / 2 + 2]; int cnt; void merge(int A[], int left, int right, int mid) { for (int i = 0; i < mid - left; i++) L[i] = A[left + i]; for (int i = 0; i < right - mid; i++) R[i] = A[mid + i]; L[mid ...
[["+", 0, 7, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
359
4
#include <iostream> using namespace std; #define INFTY 100000000 int c; int merge(int A[], int left, int mid, int right) { int n1 = mid - left; int n2 = right - mid; int L[n1], R[n2]; for (int i = 0; i <= n1; i++) { L[i] = A[left + i]; } for (int i = 0; i <= n2; i++) { R[i] = A[mid + i]; } L[...
#include <iostream> using namespace std; #define INFTY 100000000000 int c; int merge(int A[], int left, int mid, int right) { int n1 = mid - left; int n2 = right - mid; int L[n1], R[n2]; for (int i = 0; i <= n1; i++) { L[i] = A[left + i]; } for (int i = 0; i <= n2; i++) { R[i] = A[mid + i]; } ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
360
6
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define pb push_back #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, n) for (int i = a; i < (n); i++) #define mod (ll)(1e9 + 7) #define int ll #define MAX 500000 #define SENTINEL 2000000000 __attribute__((c...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define pb push_back #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, n) for (int i = a; i < (n); i++) #define mod (ll)(1e9 + 7) #define int ll #define MAX 500000 #define SENTINEL 2000000000 __attribute__((c...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
404
2
#include <stdio.h> #define INF 1 << 30 int count; void merge(int *A, int left, int mid, int right) { int n1 = mid - left; int n2 = right - mid; int L[n1 + 1], R[n2 + 1]; for (int i = 0; i < n1; i++) L[i] = A[left + i]; for (int i = 0; i < n2; i++) R[i] = A[mid + i]; L[n1] = INF; R[n2] = INF; ...
#include <stdio.h> #define INF 1 << 30 int count; void merge(int *A, int left, int mid, int right) { int n1 = mid - left; int n2 = right - mid; int L[n1 + 1], R[n2 + 1]; for (int i = 0; i < n1; i++) L[i] = A[left + i]; for (int i = 0; i < n2; i++) R[i] = A[mid + i]; L[n1] = INF; R[n2] = INF; ...
[["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
376
5
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } point; void koch(int d, point p1, point p2) { if (d == 0) return; point s, t, u; s.x = (p1.x * 2 + p2.x) / 3; s.y = (p1.y * 2 + p2.y) / 3; t.x = (p1.x + p2.x * 2) / 3; t.y = (p1.y + p2.y * 2) / 3; u.x = (p1.x + p2.y) / 2...
#include <math.h> #include <stdio.h> typedef struct { double x; double y; } point; void koch(int d, point p1, point p2) { if (d == 0) return; point s, t, u; s.x = (p1.x * 2 + p2.x) / 3; s.y = (p1.y * 2 + p2.y) / 3; t.x = (p1.x + p2.x * 2) / 3; t.y = (p1.y + p2.y * 2) / 3; u.x = (p1.x + p2.x) / 2...
[["-", 31, 16, 31, 23, 0, 16, 12, 118, 119, 120], ["+", 31, 16, 31, 23, 0, 16, 12, 118, 119, 120]]
0
373
2
#include <math.h> #include <stdio.h> struct point { double x, y; }; void koch(int n, struct point a, struct point b) { if (n == 0) return; struct point s, t, u; double rad = 3.1415926535897932384626 / 3; s.x = (2 * a.x + b.x) / 3; s.y = (2 * a.y + b.y) / 3; t.x = (a.y + 2 * b.x) / 3; t.y = (a.y + 2 ...
#include <math.h> #include <stdio.h> struct point { double x, y; }; void koch(int n, struct point a, struct point b) { if (n == 0) return; struct point s, t, u; double rad = 3.1415926535897932384626 / 3; s.x = (2 * a.x + b.x) / 3; s.y = (2 * a.y + b.y) / 3; t.x = (a.x + 2 * b.x) / 3; t.y = (a.y + 2 ...
[["-", 12, 16, 31, 23, 0, 16, 31, 118, 119, 120], ["+", 12, 16, 31, 23, 0, 16, 31, 118, 119, 120], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72]]
0
471
4
#include <math.h> #include <stdio.h> #define PI acos(-1) int limit; void koch(double *, double *, int); main() { int count = 1; double start[2] = {0, 0}, end[2] = {100, 0}; scanf("%d", &limit); printf("%.5f %.5f\n", start[0], start[1]); if (limit) { koch(start, end, count); } printf("%.5f, %.5f\n", en...
#include <math.h> #include <stdio.h> #define PI acos(-1) int limit; void koch(double *, double *, int); main() { int count = 1; double start[2] = {0, 0}, end[2] = {100, 0}; scanf("%d", &limit); printf("%.5f %.5f\n", start[0], start[1]); if (limit) { koch(start, end, count); } printf("%.5f %.5f\n", end...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
523
10
#include <math.h> #include <stdio.h> int get_uint() { int n = 0; int c = getchar_unlocked(); if (c < 48 || 57 < c) return c; while (47 < c && c < 58) { n = 10 * n + (c & 0xf); c = getchar_unlocked(); } return n; } typedef struct Point { double x; double y; } Point; void koch(int n, Point le...
#include <math.h> #include <stdio.h> int get_uint() { int n = 0; int c = getchar_unlocked(); if (c < 48 || 57 < c) return c; while (47 < c && c < 58) { n = 10 * n + (c & 0xf); c = getchar_unlocked(); } return n; } typedef struct Point { double x; double y; } Point; void koch(int n, Point le...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
0
427
2
#include <math.h> #include <stdio.h> typedef struct a { double x; double y; } Point; void kohho(Point, Point, int); Point start, end; int main() { int n; start.x = 0; start.y = 0; end.x = 100; end.y = 0; scanf("%d", &n); printf("%f %f\n", start.x, start.y); kohho(start, end, n); printf("%f %f\n", ...
#include <math.h> #include <stdio.h> typedef struct a { double x; double y; } Point; void kohho(Point, Point, int); Point start, end; int main() { int n; start.x = 0; start.y = 0; end.x = 100; end.y = 0; scanf("%d", &n); printf("%f %f\n", start.x, start.y); kohho(start, end, n); printf("%f %f\n", ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
0
404
2
#include <math.h> #include <stdio.h> #include <stdlib.h> #define PI 3.141592 typedef struct { double x, y; } XY; void fractal(int, XY, XY); void prt(XY); int main() { int n; XY p1 = {0, 0}; XY p2 = {100, 0}; scanf("%d", &n); prt(p1); fractal(n, p1, p2); prt(p2); return 0; } void fractal(int n,...
#include <math.h> #include <stdio.h> #include <stdlib.h> #define PI 3.141592 typedef struct { double x, y; } XY; void fractal(int, XY, XY); void prt(XY); int main() { int n; XY p1 = {0, 0}; XY p2 = {100, 0}; scanf("%d", &n); prt(p1); fractal(n, p1, p2); prt(p2); return 0; } void fractal(int n,...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
371
2
#include <math.h> #include <stdio.h> #define pi M_PI typedef struct XY { double x; double y; } P; P koch(P pre, P nex, int n) { P PREV, MID, NEXT, DIS; if (n == 0) printf("%f %f\n", pre.x, pre.y); else { DIS.x = nex.x - pre.x; DIS.y = nex.y - pre.y; PREV.x = pre.x + DIS.x / 3.0; NEXT.x =...
#include <math.h> #include <stdio.h> #define pi M_PI typedef struct xy { double x; double y; } P; P koch(P pre, P nex, int n) { P PREV, MID, NEXT, DIS; if (n == 0) printf("%f %f\n", pre.x, pre.y); else { DIS.x = nex.x - pre.x; DIS.y = nex.y - pre.y; PREV.x = pre.x + DIS.x / 3.0; NEXT.x =...
[["-", 36, 36, 0, 30, 0, 134, 39, 122, 141, 78], ["+", 36, 36, 0, 30, 0, 134, 39, 122, 141, 78], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13]]
0
343
4
#include <math.h> #include <stdio.h> int koch(double x1, double y1, double x2, double y2, int n) { if (n == 0) { printf("%f %f\n", x2, y2); return 0; } double Sx, Sy, Tx, Ty, Ux, Uy; Sx = (x2 - x1) / 3 + x1; Sy = (y2 - y1) / 3 + y1; Tx = (x2 - x1) * 2 / 3 + x1; Ty = (y2 - y1) / 3 + y1; Ux = (co...
#include <math.h> #include <stdio.h> int koch(double x1, double y1, double x2, double y2, int n) { if (n == 0) { printf("%f %f\n", x2, y2); return 0; } double Sx, Sy, Tx, Ty, Ux, Uy; Sx = (x2 - x1) / 3 + x1; Sy = (y2 - y1) / 3 + y1; Tx = (x2 - x1) * 2 / 3 + x1; Ty = (y2 - y1) * 2 / 3 + y1; Ux =...
[["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 12, 13]]
0
295
2
#include <math.h> #include <stdio.h> void koch(double, double, double, double, int); int main() { int n; double x1 = 0.0, x2 = 100.0; double y1 = 0.0, y2 = 0.0; scanf("%d", &n); printf("%f %f\n", x1, y1); koch(x1, y1, x2, y2, n); return 0; } void koch(double x1, double y1, double x2, double y2, int n)...
#include <math.h> #include <stdio.h> void koch(double, double, double, double, int); int main() { int n; double x1 = 0.0, x2 = 100.0; double y1 = 0.0, y2 = 0.0; scanf("%d", &n); printf("%f %f\n", x1, y1); koch(x1, y1, x2, y2, n); return 0; } void koch(double x1, double y1, double x2, double y2, int n)...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
316
4
#include <bits/stdc++.h> using namespace std; struct point { double x, y; }; void koch(int n, point p1, point p2) { point p3, p4, p5; double rad60 = M_PI * 60.0 / 180.0; if (n == 0) return; p3.x = (2.0 * p1.x + p2.x) / 3.0; p3.y = (2.0 * p1.y + p2.y) / 3.0; p4.x = (p1.x + 2.0 * p2.x) / 3.0; p4....
#include <bits/stdc++.h> using namespace std; struct point { double x, y; }; void koch(int n, point p1, point p2) { point p3, p4, p5; double rad60 = M_PI * 60.0 / 180.0; if (n == 0) return; p3.x = (2.0 * p1.x + p2.x) / 3.0; p3.y = (2.0 * p1.y + p2.y) / 3.0; p4.x = (p1.x + 2.0 * p2.x) / 3.0; p4....
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21]]
1
387
8
#include "bits/stdc++.h" using namespace std; using LL = long long; using ULL = unsigned long long; const double PI = acos(-1); template <class T> constexpr T INF() { return ::std::numeric_limits<T>::max(); } template <class T> constexpr T HINF() { return INF<T>() / 2; } template <typename T_char> T_char TL(T_char cX) ...
#include "bits/stdc++.h" using namespace std; using LL = long long; using ULL = unsigned long long; const double PI = acos(-1); template <class T> constexpr T INF() { return ::std::numeric_limits<T>::max(); } template <class T> constexpr T HINF() { return INF<T>() / 2; } template <typename T_char> T_char TL(T_char cX) ...
[["-", 12, 16, 31, 16, 31, 16, 12, 2, 63, 22], ["+", 12, 16, 31, 16, 31, 16, 12, 2, 63, 22]]
1
837
2
#include <cmath> #include <iomanip> #include <iostream> #include <list> #include <utility> using namespace std; class vec2d { public: double x, y; vec2d(double _x, double _y) { x = _x; y = _y; } vec2d() { x = 0; y = 0; } vec2d transform(double rotate, double magnify) { vec2d ret; r...
#include <cmath> #include <iomanip> #include <iostream> #include <list> #include <utility> using namespace std; class vec2d { public: double x, y; vec2d(double _x, double _y) { x = _x; y = _y; } vec2d() { x = 0; y = 0; } vec2d transform(double rotate, double magnify) { vec2d ret; r...
[["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
520
3
// // main.cpp // ALDS1_5_C // // Created by ptyuan on 2018/10/27. // Copyright © 2018 Sy. All rights reserved. // #include <cmath> #include <cstdio> #include <iostream> using namespace std; struct Point { double x; double y; }; void koch(int n, Point a, Point b) { if (0 == n) { return; } Point s...
// // main.cpp // ALDS1_5_C // // Created by ptyuan on 2018/10/27. // Copyright © 2018 Sy. All rights reserved. // #include <cmath> #include <cstdio> #include <iostream> using namespace std; struct Point { double x; double y; }; void koch(int n, Point a, Point b) { if (0 == n) { return; } Point s...
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 85], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48]]
1
411
2
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef struct { double x; double y; } xy; void kock(int, xy, xy); int main() { xy p1 = {0.00, 0.00}, p2 = {100.000, 0.00}; int n; cin >> n; cout << p1.x << " " << p1.y << endl; kock(n, p1, p2); cout << p2.x << " " << p2.y << endl; re...
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef struct { double x; double y; } xy; void kock(int, xy, xy); int main() { xy p1 = {0.00, 0.00}, p2 = {100.000, 0.00}; int n; cin >> n; cout << p1.x << " " << p1.y << endl; kock(n, p1, p2); cout << p2.x << " " << p2.y << endl; re...
[["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]]
1
367
4
#include <math.h> #include <stdio.h> struct Point2 { double x, y; Point2() { x = 0; y = 0; } Point2(double x_, double y_) { x = x_; y = y_; } Point2 operator+(const Point2 &rhs) const { return Point2(x + rhs.x, y + rhs.y); } Point2 operator-(const Point2 &rhs) const { return...
#include <math.h> #include <stdio.h> struct Point2 { double x, y; Point2() { x = 0; y = 0; } Point2(double x_, double y_) { x = x_; y = y_; } Point2 operator+(const Point2 &rhs) const { return Point2(x + rhs.x, y + rhs.y); } Point2 operator-(const Point2 &rhs) const { return...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
526
2
#include <iostream> #include <math.h> using namespace std; int n; struct Point { double x, y; }; void KorchCurve(int d, Point p1, Point p2) { if (d == 0) return; // 与えられたp1, p2から三等分する Point s, u, t; double theta = M_PI * 60.0 / 180.0; s.x = (p1.x * 2 + p2.x) / 3; s.y = (p1.y * 2 + p2.y) / 3; t.x ...
#include <iostream> #include <math.h> using namespace std; int n; struct Point { double x, y; }; void KorchCurve(int d, Point p1, Point p2) { if (d == 0) return; // 与えられたp1, p2から三等分する Point s, u, t; double theta = M_PI * 60.0 / 180.0; s.x = (p1.x * 2 + p2.x) / 3; s.y = (p1.y * 2 + p2.y) / 3; t.x ...
[["-", 12, 16, 31, 23, 0, 16, 31, 118, 119, 120], ["+", 12, 16, 31, 23, 0, 16, 31, 118, 119, 120]]
1
389
2
#include <iostream> #include <math.h> #include <stdio.h> struct point { double x, y; }; void koch(int d, point p1, point p2) { if (d == 0) { return; } point s, t, u; double rad = M_PI * 60.0 / 180.0; s.x = (2 * p1.x + 1 * p2.x) / 3; s.y = (2 * p1.y + 1 * p2.y) / 3; t.x = (1 * p1.x + 2 * p2.x) / 3...
#include <iostream> #include <math.h> #include <stdio.h> struct point { double x, y; }; void koch(int d, point p1, point p2) { if (d == 0) { return; } point s, t, u; double rad = M_PI * 60.0 / 180.0; s.x = (2 * p1.x + 1 * p2.x) / 3; s.y = (2 * p1.y + 1 * p2.y) / 3; t.x = (1 * p1.x + 2 * p2.x) / 3...
[["-", 31, 23, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 31, 23, 0, 16, 31, 16, 12, 118, 119, 120], ["-", 0, 1, 0, 2, 3, 4, 0, 118, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 118, 28, 22]]
1
397
4
#include <iomanip> #include <iostream> #include <math.h> #include <string> using namespace std; int n; long double pi = 3.141592653; struct Node { long double x; long double y; }; void koch(int d, Node p1, Node p2) { if (d == 0) return; Node s, t, u; s.x = (2 * p1.x + 1 * p2.x) / 3; s.y = (2 * p1....
#include <iomanip> #include <iostream> #include <math.h> #include <string> using namespace std; int n; long double pi = 3.141592653; struct Node { long double x; long double y; }; void koch(int d, Node p1, Node p2) { if (d == 0) return; Node s, t, u; s.x = (2 * p1.x + 1 * p2.x) / 3; s.y = (2 * p1....
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
1
441
2
#include <cmath> #include <iomanip> #include <iostream> using namespace std; const double PI = acos(-1); void koch(int n, pair<double, double> p1, pair<double, double> p2) { if (n == 0) return; pair<double, double> s, t, u; double th = PI * 60 / 180; s.first = (2.0 * p1.first + 1.0 * p2.first) / 3.0; s...
#include <cmath> #include <iomanip> #include <iostream> using namespace std; const double PI = acos(-1); void koch(int n, pair<double, double> p1, pair<double, double> p2) { if (n == 0) return; pair<double, double> s, t, u; double th = PI * 60 / 180; s.first = (2.0 * p1.first + 1.0 * p2.first) / 3.0; s...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
1
416
2
#include <algorithm> #include <complex> #include <iomanip> #include <iostream> #include <math.h> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); i++) typedef vector<int> VI; typedef double D; // 座標値の型。doubleかlong doubleを想定 typedef complex<D> P; // Point #define X real() #define...
#include <algorithm> #include <complex> #include <iomanip> #include <iostream> #include <math.h> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); i++) typedef vector<int> VI; typedef double D; // 座標値の型。doubleかlong doubleを想定 typedef complex<D> P; // Point #define X real() #define...
[["+", 0, 43, 49, 50, 51, 16, 12, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 16, 12, 16, 17, 48]]
1
271
2
#include <cmath> #include <cstdio> #include <iostream> using namespace std; struct Point { double x; double y; }; void koch(int n, Point a, Point b) { if (n == 0) return; Point s, t, u; double th = M_PI * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3.0; t.x ...
#include <cmath> #include <cstdio> #include <iostream> using namespace std; struct Point { double x; double y; }; void koch(int n, Point a, Point b) { if (n == 0) return; Point s, t, u; double th = M_PI * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3.0; t.x ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33]]
1
394
2
#define _CRT_SECURE_NO_WARNINGS #include <math.h> #include <stdio.h> #include <vector> using namespace std; struct Point { double x; double y; }; vector<Point> Points[2]; int zeroOne; int oneZero; int n; void getPoints(Point *p1, Point *p2, Point *s, Point *u, Point *t) { s->x = (2.0 * p1->x + p2->x) / 3.0; ...
#define _CRT_SECURE_NO_WARNINGS #include <math.h> #include <stdio.h> #include <vector> using namespace std; struct Point { double x; double y; }; vector<Point> Points[2]; int zeroOne; int oneZero; int n; void getPoints(Point *p1, Point *p2, Point *s, Point *u, Point *t) { s->x = (2.0 * p1->x + p2->x) / 3.0; ...
[["-", 8, 9, 0, 43, 49, 50, 51, 11, 17, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33]]
1
526
2
#include <algorithm> #include <bitset> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> #include <cmath> #include <cstdint> #include <cstdio> using namespace std; constexpr double pi = 3.14...
#include <algorithm> #include <bitset> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> #include <cmath> #include <cstdint> #include <cstdio> using namespace std; constexpr double pi = 3.14...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18]]
1
551
2
#include <iostream> #include <math.h> #include <stdio.h> double PI = M_PI * 60 / 180; using namespace std; void solve(int deep, pair<double, double> begin, pair<double, double> end) { if (deep == 0) { return; } pair<double, double> s = make_pair((2 * begin.first + end.first) / 3, ...
#include <iostream> #include <math.h> #include <stdio.h> double PI = M_PI * 60 / 180; using namespace std; void solve(int deep, pair<double, double> begin, pair<double, double> end) { if (deep == 0) { return; } pair<double, double> s = make_pair((2 * begin.first + end.first) / 3, ...
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 33], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 72]]
1
400
2
#include <math.h> #include <stdio.h> #include <utility> using namespace std; typedef pair<double, double> Point; int n; const double cos60 = cos(M_PI / 3.0); const double sin60 = sin(M_PI / 3.0); void solve(int i, Point p0, Point p1); int main() { Point p0, p1; p0.first = 0.0; p0.second = 0.0; p1.first = 1...
#include <math.h> #include <stdio.h> #include <utility> using namespace std; typedef pair<double, double> Point; int n; const double cos60 = cos(M_PI / 3.0); const double sin60 = sin(M_PI / 3.0); void solve(int i, Point p0, Point p1); int main() { Point p0, p1; p0.first = 0.0; p0.second = 0.0; p1.first = 1...
[["-", 0, 11, 12, 16, 31, 16, 31, 118, 119, 120], ["+", 0, 11, 12, 16, 31, 16, 31, 118, 119, 120], ["-", 0, 11, 12, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 31, 22]]
1
330
6
#include <cmath> #include <iomanip> #include <iostream> using namespace std; typedef pair<float, float> point; const float rad = (M_PI * 60) / 180.0; int n; void koch(int d, point p1, point p2) { if (!d) return; float sx = (2 * p1.first + 1 * p2.first) / 3; float sy = (2 * p1.second + 1 * p2.second) / 3; ...
#include <cmath> #include <iomanip> #include <iostream> using namespace std; typedef pair<float, float> point; const float rad = (M_PI * 60) / 180.0; int n; void koch(int d, point p1, point p2) { if (!d) return; float sx = (2 * p1.first + 1 * p2.first) / 3; float sy = (2 * p1.second + 1 * p2.second) / 3; ...
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
369
4
#include <iostream> #include <math.h> using namespace std; struct Point { double x; double y; }; int Kcurve(int n, Point p1, Point p2) { if (n == 0) { return 0; } Point a, b, c; a.x = (2.0 / 3.0) * p1.x + (1.0 / 3.0) * p2.x; a.y = (2.0 / 3.0) * p1.y + (1.0 / 3.0) * p2.y; b.x = p1.x + (1.0 / 2.0) *...
#include <iostream> #include <math.h> using namespace std; struct Point { double x; double y; }; int Kcurve(int n, Point p1, Point p2) { if (n == 0) { return 0; } Point a, b, c; a.x = (2.0 / 3.0) * p1.x + (1.0 / 3.0) * p2.x; a.y = (2.0 / 3.0) * p1.y + (1.0 / 3.0) * p2.y; b.x = p1.x + (1.0 / 2.0) *...
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
414
4
// // Created by ?????°?????? on 2016/03/19. // #include <iomanip> #include <iostream> #include <math.h> using namespace std; struct point { double x, y; }; void koch(int n, point a, point b) { if (n == 0) return; point s, t, u; double th = M_PI * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s...
// // Created by ?????°?????? on 2016/03/19. // #include <iomanip> #include <iostream> #include <math.h> using namespace std; struct point { double x, y; }; void koch(int n, point a, point b) { if (n == 0) return; point s, t, u; double th = M_PI * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
1
445
2
#include <bits/stdc++.h> using namespace std; void koch(double, double, double, double, int cnt); int n; int main() { cin >> n; printf("%.8f %.8f\n", 0, 0); koch(0, 0, 100, 0, 0); printf("%.8f %.8f\n", 100, 0); return 0; } void koch(double x1, double y1, double x2, double y2, int cnt) { if (cnt == n) { ...
#include <bits/stdc++.h> using namespace std; void koch(double, double, double, double, int cnt); int n; int main() { cin >> n; printf("%.8f %.8f\n", 0, 0); koch(0, 0, 100, 0, 0); printf("%.8f %.8f\n", 100.0, 0); return 0; } void koch(double x1, double y1, double x2, double y2, int cnt) { if (cnt == n) ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
304
2
#include <algorithm> #include <cmath> #include <iostream> #include <list> struct Point { double x; double y; }; typedef std::list<Point> List; Point GetU(const Point &s, const Point &t) { const double thete = 60. / 180. * M_PI; Point st = {t.x - s.x, t.y - s.y}; Point su = {st.x * std::cos(thete) - st.y * st...
#include <algorithm> #include <cmath> #include <iostream> #include <list> struct Point { double x; double y; }; typedef std::list<Point> List; Point GetU(const Point &s, const Point &t) { const double thete = 60. / 180. * M_PI; Point st = {t.x - s.x, t.y - s.y}; Point su = {st.x * std::cos(thete) - st.y * st...
[["-", 49, 50, 51, 83, 0, 16, 31, 118, 28, 22], ["+", 49, 50, 51, 83, 0, 16, 31, 118, 28, 22]]
1
478
2
#include <cmath> #include <iomanip> #include <iostream> #include <list> #include <math.h> #include <stdio.h> using namespace std; void Koch_Curve(int d, double x1, double y1, double x2, double y2) { if (d == 0) return; double sx = (2 * x1 + x2) / 3, sy = (2 * y1 + y2) / 3, tx = (x1 + 2 * x2) / 3, ty =...
#include <cmath> #include <iomanip> #include <iostream> #include <list> #include <math.h> #include <stdio.h> using namespace std; void Koch_Curve(int d, double x1, double y1, double x2, double y2) { if (d == 0) return; double sx = (2 * x1 + x2) / 3, sy = (2 * y1 + y2) / 3, tx = (x1 + 2 * x2) / 3, ty =...
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 33], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 72]]
1
324
2
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <set> #include <stack> #include <vector> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define PUSH(n, v) ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <set> #include <stack> #include <vector> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define PUSH(n, v) ...
[["-", 3, 4, 0, 16, 31, 16, 31, 118, 28, 22], ["+", 3, 4, 0, 16, 31, 16, 31, 118, 28, 22], ["-", 0, 2, 3, 4, 0, 16, 12, 118, 28, 22], ["+", 0, 2, 3, 4, 0, 16, 12, 118, 28, 22], ["-", 0, 37, 0, 2, 3, 4, 0, 118, 28, 22], ["+", 0, 37, 0, 2, 3, 4, 0, 118, 28, 22]]
1
653
12
#include <cmath> #include <cstdio> #define PI acos(-1) #define scanf_s scanf struct Point { double x, y; }; void koch(int n, Point a, Point b) { if (n == 0) return; Point s, t, u; double rad = PI * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3.0; t.x = (1.0 * a.x...
#include <cmath> #include <cstdio> #define PI acos(-1) #define scanf_s scanf struct Point { double x, y; }; void koch(int n, Point a, Point b) { if (n == 0) return; Point s, t, u; double rad = PI * 60.0 / 180.0; s.x = (2.0 * a.x + 1.0 * b.x) / 3.0; s.y = (2.0 * a.y + 1.0 * b.y) / 3.0; t.x = (1.0 * a.x...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
1
398
2
#include <algorithm> #include <cstdio> #include <utility> #include <vector> using namespace std; const double cos60 = 0.500000000000000; const double sin60 = 0.866025403784439; void koch_snowflake(size_t n, pair<double, double> p1, pair<double, double> p2) { if (!n) return; pair<double, ...
#include <algorithm> #include <cstdio> #include <utility> #include <vector> using namespace std; const double cos60 = 0.500000000000000; const double sin60 = 0.866025403784439; void koch_snowflake(size_t n, pair<double, double> p1, pair<double, double> p2) { if (!n) return; pair<double, ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
370
2
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> #include <string> #define rep(i, o, u) for (int i = o; i <= u; i++) typedef unsigned long long ll; using namespace std; struct point { double x; double y; }; void solve(int n, point a, point b) { if (n == 0) retu...
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> #include <string> #define rep(i, o, u) for (int i = o; i <= u; i++) typedef unsigned long long ll; using namespace std; struct point { double x; double y; }; void solve(int n, point a, point b) { if (n == 0) retu...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
1
415
2
#include <cmath> #include <iomanip> #include <iostream> using namespace std; typedef struct point { double x, y; } P; void show(P p) { cout << fixed << setprecision(5); cout << p.x << ' ' << p.y << endl; } void work(P p1, P p2, int n) { if (n == 0) return; P p3, p4, p5; double dx, dy, a, b; p3.x = 2 /...
#include <cmath> #include <iomanip> #include <iostream> using namespace std; typedef struct point { double x, y; } P; void show(P p) { cout << fixed << setprecision(5); cout << p.x << ' ' << p.y << endl; } void work(P p1, P p2, int n) { if (n == 0) return; P p3, p4, p5; double dx, dy, a, b; p3.x = 2. ...
[["-", 0, 11, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 31, 13]]
1
355
8
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; typedef pair<double, double> P; int n; void Koch(P p1, P p2, int n1) { P s, t, u; ...
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; typedef pair<double, double> P; int n; void Koch(P p1, P p2, int n1) { P s, t, u; ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
371
2
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> using namespace std; struct zahyou { double x, y; }; void print_zahyou(zahyou z) { printf("%.5lf %.5lf\n", z.x, z.y); } void koch(int d, zahyou p1, zahyou p2) { zahyou s, u, t; if (d == 0) return; s.x = (2 * p1.x + 1 * p2.x) / ...
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> using namespace std; struct zahyou { double x, y; }; void print_zahyou(zahyou z) { printf("%.8lf %.8lf\n", z.x, z.y); } void koch(int d, zahyou p1, zahyou p2) { zahyou s, u, t; if (d == 0) return; s.x = (2 * p1.x + 1 * p2.x) / ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
1
366
6
#include <algorithm> #include <cassert> #include <cmath> #include <iostream> #include <string> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define rep(i, n) FOR(i, 0, n) #define DEBUG(x) cout << #x << ": " << x << endl #define vint vector<int> #define vdouble ve...
#include <algorithm> #include <cassert> #include <cmath> #include <iostream> #include <string> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define rep(i, n) FOR(i, 0, n) #define DEBUG(x) cout << #x << ": " << x << endl #define vint vector<int> #define vdouble ve...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]]
1
465
2
#define _USE_MATH_DEFINES #include <cmath> #include <complex> #include <iomanip> #include <iostream> typedef std::complex<double> Comp_d; // using Comp_d = std::complex<double>; void KochCurve(int n, Comp_d p1, Comp_d p2) { if (n == 0) { return; } Comp_d s = p1 + (p2 - p1) / 3.; Comp_d t = p1 + 2. * (p2 - p...
#define _USE_MATH_DEFINES #include <cmath> #include <complex> #include <iomanip> #include <iostream> typedef std::complex<double> Comp_d; // using Comp_d = std::complex<double>; void KochCurve(int n, Comp_d p1, Comp_d p2) { if (n == 0) { return; } Comp_d s = p1 + (p2 - p1) / 3.; Comp_d t = p1 + 2. * (p2 - p...
[["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
339
10
#include <cstdio> #include <iostream> #include <math.h> using namespace std; struct Point { double x; double y; }; void koch(int n, Point a, Point b) { if (n == 0) return; Point s, u, t; double th = M_PI * 60.0 / 180.0; s.x = (b.x + 2 * a.x) / 3; s.y = (b.y + 2 * a.y) / 3; t.x = (2 * b.x + a.x) ...
#include <cstdio> #include <iostream> #include <math.h> using namespace std; struct Point { double x; double y; }; void koch(int n, Point a, Point b) { if (n == 0) return; Point s, u, t; double th = M_PI * 60.0 / 180.0; s.x = (b.x + 2 * a.x) / 3; s.y = (b.y + 2 * a.y) / 3; t.x = (2 * b.x + a.x) ...
[["-", 12, 16, 31, 23, 0, 16, 12, 118, 28, 22], ["+", 12, 16, 31, 23, 0, 16, 12, 118, 28, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
381
6
#include <cassert> #include <cmath> #include <iostream> using namespace std; void spr(double, double, double, double, int); int main() { double x1 = 0.0, y1 = 0.0, x2 = 100.0, y2 = 0.0; int d; cin >> d; spr(x1, y1, x2, y2, d); cout << fixed << x2 << ' ' << y2 << endl; return 0; } void spr(double x1, do...
#include <cassert> #include <cmath> #include <iostream> using namespace std; void spr(double, double, double, double, int); int main() { double x1 = 0.0, y1 = 0.0, x2 = 100.0, y2 = 0.0; int d; cin >> d; spr(x1, y1, x2, y2, d); cout << fixed << x2 << ' ' << y2 << endl; return 0; } void spr(double x1, do...
[["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
317
4
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) #define reg(i, a, b) for (in...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) #define reg(i, a, b) for (in...
[["+", 31, 2, 3, 4, 0, 16, 31, 91, 17, 33]]
1
338
4