forked from NUDT-compiler/nudt-compiler-cpp
parent
1ff1b543d1
commit
feaba9abd4
@ -0,0 +1 @@
|
||||
21
|
||||
@ -0,0 +1,9 @@
|
||||
int main(){
|
||||
const int a[4][2] = {{1, 2}, {3, 4}, {}, 7};
|
||||
const int N = 3;
|
||||
int b[4][2] = {};
|
||||
int c[4][2] = {1, 2, 3, 4, 5, 6, 7, 8};
|
||||
int d[N + 1][2] = {1, 2, {3}, {5}, a[3][0], 8};
|
||||
int e[4][2][1] = {{d[2][1], {c[2][1]}}, {3, 4}, {5, 6}, {7, 8}};
|
||||
return e[3][1][0] + e[0][0][0] + e[0][1][0] + d[3][0];
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
9
|
||||
@ -0,0 +1,11 @@
|
||||
int a;
|
||||
int func(int p){
|
||||
p = p - 1;
|
||||
return p;
|
||||
}
|
||||
int main(){
|
||||
int b;
|
||||
a = 10;
|
||||
b = func(a);
|
||||
return b;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
9
|
||||
@ -0,0 +1,7 @@
|
||||
//test add
|
||||
int main(){
|
||||
int a, b;
|
||||
a = 10;
|
||||
b = -1;
|
||||
return a + b;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
248
|
||||
@ -0,0 +1,7 @@
|
||||
//test sub
|
||||
const int a = 10;
|
||||
int main(){
|
||||
int b;
|
||||
b = 2;
|
||||
return b - a;
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
1 2 3 2
|
||||
0
|
||||
@ -0,0 +1,69 @@
|
||||
const int V = 4;
|
||||
const int space = 32;
|
||||
const int LF = 10;
|
||||
|
||||
void printSolution(int color[]) {
|
||||
int i = 0;
|
||||
while (i < V) {
|
||||
putint(color[i]);
|
||||
putch(space);
|
||||
i = i + 1;
|
||||
}
|
||||
putch(LF);
|
||||
}
|
||||
|
||||
void printMessage() {
|
||||
putch(78);putch(111);putch(116);
|
||||
putch(space);
|
||||
putch(101);putch(120);putch(105);putch(115);putch(116);
|
||||
}
|
||||
|
||||
int isSafe(int graph[][V], int color[]) {
|
||||
int i = 0;
|
||||
while (i < V) {
|
||||
int j = i + 1;
|
||||
while (j < V) {
|
||||
if (graph[i][j] && color[j] == color[i])
|
||||
return 0;
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int graphColoring(int graph[][V], int m, int i, int color[]) {
|
||||
if (i == V) {
|
||||
if (isSafe(graph, color)) {
|
||||
printSolution(color);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int j = 1;
|
||||
while (j <= m) {
|
||||
color[i] = j;
|
||||
if (graphColoring(graph, m, i + 1, color))
|
||||
return 1;
|
||||
color[i] = 0;
|
||||
j = j + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int graph[V][V] = {
|
||||
{0, 1, 1, 1},
|
||||
{1, 0, 1, 0},
|
||||
{1, 1, 0, 1},
|
||||
{1, 0, 1, 0}
|
||||
}, m = 3;
|
||||
int color[V], i = 0;
|
||||
while (i < V) {
|
||||
color[i] = 0;
|
||||
i = i + 1;
|
||||
}
|
||||
if (!graphColoring(graph, m, 0, color))
|
||||
printMessage();
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
4 4
|
||||
1 2 3 4
|
||||
5 6 7 8
|
||||
9 10 11 12
|
||||
13 14 15 16
|
||||
4 3
|
||||
9 5 1
|
||||
10 6 2
|
||||
11 7 3
|
||||
12 8 4
|
||||
@ -0,0 +1,5 @@
|
||||
110 70 30
|
||||
278 174 70
|
||||
446 278 110
|
||||
614 382 150
|
||||
0
|
||||
@ -0,0 +1,60 @@
|
||||
const int MAX_SIZE = 100;
|
||||
int a[MAX_SIZE][MAX_SIZE], b[MAX_SIZE][MAX_SIZE];
|
||||
int res[MAX_SIZE][MAX_SIZE];
|
||||
int n1, m1, n2, m2;
|
||||
void matrix_multiply() {
|
||||
int i = 0;
|
||||
while (i < m1) {
|
||||
int j = 0;
|
||||
while (j < n2) {
|
||||
int k = 0;
|
||||
while (k < n1) {
|
||||
res[i][j] = res[i][j] + a[i][k] * b[k][j];
|
||||
k = k + 1;
|
||||
}
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int i, j;
|
||||
m1 = getint();
|
||||
n1 = getint();
|
||||
i = 0;
|
||||
while (i < m1) {
|
||||
j = 0;
|
||||
while (j < n1) {
|
||||
a[i][j] = getint();
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
m2 = getint();
|
||||
n2 = getint();
|
||||
i = 0;
|
||||
while (i < m2) {
|
||||
j = 0;
|
||||
while (j < n2) {
|
||||
b[i][j] = getint();
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
matrix_multiply();
|
||||
i = 0;
|
||||
while (i < m1) {
|
||||
j = 0;
|
||||
while (j < n2) {
|
||||
putint(res[i][j]);
|
||||
putch(32);
|
||||
j = j + 1;
|
||||
}
|
||||
putch(10);
|
||||
i = i + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
a
|
||||
46
|
||||
@ -0,0 +1 @@
|
||||
int main() { /* scope test */ putch(97); putch(10); int a = 1, putch = 0; { a = a + 2; int b = a + 3; b = b + 4; putch = putch + a + b; { b = b + 5; int main = b + 6; a = a + main; putch = putch + a + b + main; { b = b + a; int a = main + 7; a = a + 8; putch = putch + a + b + main; { b = b + a; int b = main + 9; a = a + 10; const int a = 11; b = b + 12; putch = putch + a + b + main; { main = main + b; int main = b + 13; main = main + a; putch = putch + a + b + main; } putch = putch - main; } putch = putch - b; } putch = putch - a; } } return putch % 77; }
|
||||
@ -0,0 +1 @@
|
||||
201
|
||||
@ -0,0 +1,15 @@
|
||||
//test break
|
||||
int main(){
|
||||
int i;
|
||||
i = 0;
|
||||
int sum;
|
||||
sum = 0;
|
||||
while(i < 100){
|
||||
if(i == 50){
|
||||
break;
|
||||
}
|
||||
sum = sum + i;
|
||||
i = i + 1;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
24
|
||||
@ -0,0 +1,9 @@
|
||||
//test the priority of add and mul
|
||||
int main(){
|
||||
int a, b, c, d;
|
||||
a = 10;
|
||||
b = 4;
|
||||
c = 2;
|
||||
d = 2;
|
||||
return (c + a) * (b - d);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
10
|
||||
0x1.999999999999ap-4 0x1.999999999999ap-3 0x1.3333333333333p-2 0x1.999999999999ap-2 0x1.0000000000000p-1
|
||||
0x1.3333333333333p-1 0x1.6666666666666p-1 0x1.999999999999ap-1 0x1.ccccccccccccdp-1 0x1.0000000000000p+0
|
||||
0x1.199999999999ap+0
|
||||
0x1.199999999999ap+1
|
||||
0x1.a666666666666p+1
|
||||
0x1.199999999999ap+2
|
||||
0x1.6000000000000p+2
|
||||
0x1.a666666666666p+2
|
||||
0x1.ecccccccccccdp+2
|
||||
0x1.199999999999ap+3
|
||||
0x1.3cccccccccccdp+3
|
||||
0x1.4333333333333p+3
|
||||
@ -0,0 +1,19 @@
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
0x1.e691e6p+1 3
|
||||
0x1.e691e6p+3 12
|
||||
0x1.11b21p+5 28
|
||||
0x1.e691e6p+5 50
|
||||
0x1.7c21fcp+6 78
|
||||
0x1.11b21p+7 113
|
||||
0x1.7487b2p+7 153
|
||||
0x1.e691e6p+7 201
|
||||
0x1.33e85p+8 254
|
||||
10: 0x1.333334p+0 0x1.333334p+1 0x1.ccccccp+1 0x1.333334p+2 0x1.8p+2 0x1.ccccccp+2 0x1.0cccccp+3 0x1.333334p+3 0x1.599998p+3 0x1p+0
|
||||
0
|
||||
@ -0,0 +1,98 @@
|
||||
// float global constants
|
||||
const float RADIUS = 5.5, PI = 03.141592653589793, EPS = 1e-6;
|
||||
|
||||
// hexadecimal float constant
|
||||
const float PI_HEX = 0x1.921fb6p+1, HEX2 = 0x.AP-3;
|
||||
|
||||
// float constant evaluation
|
||||
const float FACT = -.33E+5, EVAL1 = PI * RADIUS * RADIUS, EVAL2 = 2 * PI_HEX * RADIUS, EVAL3 = PI * 2 * RADIUS;
|
||||
|
||||
// float constant implicit conversion
|
||||
const float CONV1 = 233, CONV2 = 0xfff;
|
||||
const int MAX = 1e9, TWO = 2.9, THREE = 3.2, FIVE = TWO + THREE;
|
||||
|
||||
// float -> float function
|
||||
float float_abs(float x) {
|
||||
if (x < 0) return -x;
|
||||
return x;
|
||||
}
|
||||
|
||||
// int -> float function & float/int expression
|
||||
float circle_area(int radius) {
|
||||
return (PI * radius * radius + (radius * radius) * PI) / 2;
|
||||
}
|
||||
|
||||
// float -> float -> int function & float/int expression
|
||||
int float_eq(float a, float b) {
|
||||
if (float_abs(a - b) < EPS) {
|
||||
return 1 * 2. / 2;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void error() {
|
||||
putch(101);
|
||||
putch(114);
|
||||
putch(114);
|
||||
putch(111);
|
||||
putch(114);
|
||||
putch(10);
|
||||
}
|
||||
|
||||
void ok() {
|
||||
putch(111);
|
||||
putch(107);
|
||||
putch(10);
|
||||
}
|
||||
|
||||
void assert(int cond) {
|
||||
if (!cond) {
|
||||
error();
|
||||
} else {
|
||||
ok();
|
||||
}
|
||||
}
|
||||
|
||||
void assert_not(int cond) {
|
||||
if (cond) {
|
||||
error();
|
||||
} else {
|
||||
ok();
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
assert_not(float_eq(HEX2, FACT));
|
||||
assert_not(float_eq(EVAL1, EVAL2));
|
||||
assert(float_eq(EVAL2, EVAL3));
|
||||
assert(float_eq(circle_area(RADIUS) /* f->i implicit conversion */,
|
||||
circle_area(FIVE)));
|
||||
assert_not(float_eq(CONV1, CONV2) /* i->f implicit conversion */);
|
||||
|
||||
// float conditional expressions
|
||||
if (1.5) ok();
|
||||
if (!!3.3) ok();
|
||||
if (.0 && 3) error();
|
||||
if (0 || 0.3) ok();
|
||||
|
||||
// float array & I/O functions
|
||||
int i = 1, p = 0;
|
||||
float arr[10] = {1., 2};
|
||||
int len = getfarray(arr);
|
||||
while (i < MAX) {
|
||||
float input = getfloat();
|
||||
float area = PI * input * input, area_trunc = circle_area(input);
|
||||
arr[p] = arr[p] + input;
|
||||
|
||||
putfloat(area);
|
||||
putch(32);
|
||||
putint(area_trunc); // f->i implicit conversion
|
||||
putch(10);
|
||||
|
||||
i = i * - -1e1;
|
||||
p = p + 1;
|
||||
}
|
||||
putfarray(len, arr);
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
3
|
||||
@ -0,0 +1,5 @@
|
||||
int main() {
|
||||
int a = 1;
|
||||
int b = 2;
|
||||
return a + b;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,2 @@
|
||||
1691748973
|
||||
0
|
||||
@ -0,0 +1,89 @@
|
||||
const int N = 1024;
|
||||
|
||||
void mm(int n, int A[][N], int B[][N], int C[][N]){
|
||||
int i, j, k;
|
||||
|
||||
i = 0; j = 0;
|
||||
while (i < n){
|
||||
j = 0;
|
||||
while (j < n){
|
||||
C[i][j] = 0;
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
i = 0; j = 0; k = 0;
|
||||
|
||||
while (k < n){
|
||||
i = 0;
|
||||
while (i < n){
|
||||
if (A[i][k] == 0){
|
||||
i = i + 1;
|
||||
continue;
|
||||
}
|
||||
j = 0;
|
||||
while (j < n){
|
||||
C[i][j] = C[i][j] + A[i][k] * B[k][j];
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
k = k + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int A[N][N];
|
||||
int B[N][N];
|
||||
int C[N][N];
|
||||
|
||||
int main(){
|
||||
int n = getint();
|
||||
int i, j;
|
||||
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (i < n){
|
||||
j = 0;
|
||||
while (j < n){
|
||||
A[i][j] = getint();
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (i < n){
|
||||
j = 0;
|
||||
while (j < n){
|
||||
B[i][j] = getint();
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
starttime();
|
||||
|
||||
i = 0;
|
||||
while (i < 5){
|
||||
mm(n, A, B, C);
|
||||
mm(n, A, C, B);
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
int ans = 0;
|
||||
i = 0;
|
||||
while (i < n){
|
||||
j = 0;
|
||||
while (j < n){
|
||||
ans = ans + B[i][j];
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
stoptime();
|
||||
putint(ans);
|
||||
putch(10);
|
||||
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,71 @@
|
||||
int x;
|
||||
|
||||
const int N = 2010;
|
||||
|
||||
void mv(int n, int A[][N], int b[], int res[]){
|
||||
int x, y;
|
||||
y = 0;
|
||||
x = 11;
|
||||
int i, j;
|
||||
|
||||
i = 0;
|
||||
while(i < n){
|
||||
res[i] = 0;
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (i < n){
|
||||
j = 0;
|
||||
while (j < n){
|
||||
if (A[i][j] == 0){
|
||||
x = x * b[i] + b[j];
|
||||
y = y - x;
|
||||
}else{
|
||||
res[i] = res[i] + A[i][j] * b[j];
|
||||
}
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int A[N][N];
|
||||
int B[N];
|
||||
int C[N];
|
||||
|
||||
int main(){
|
||||
int n = getint();
|
||||
int i, j;
|
||||
|
||||
i = 0;
|
||||
|
||||
while (i < n){
|
||||
j = 0;
|
||||
while (j < n){
|
||||
A[i][j] = getint();
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < n){
|
||||
B[i] = getint();
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
starttime();
|
||||
|
||||
i = 0;
|
||||
while (i < 50){
|
||||
mv(n, A, B, C);
|
||||
mv(n, A, C, B);
|
||||
i = i + 1;
|
||||
}
|
||||
stoptime();
|
||||
|
||||
putarray(n, C);
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
||||
1576633458
|
||||
0
|
||||
@ -0,0 +1,106 @@
|
||||
const int base = 16;
|
||||
|
||||
int getMaxNum(int n, int arr[]){
|
||||
int ret = 0;
|
||||
int i = 0;
|
||||
while (i < n){
|
||||
if (arr[i] > ret) ret = arr[i];
|
||||
i = i + 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int getNumPos(int num, int pos){
|
||||
int tmp = 1;
|
||||
int i = 0;
|
||||
while (i < pos){
|
||||
num = num / base;
|
||||
i = i + 1;
|
||||
}
|
||||
return num % base;
|
||||
}
|
||||
|
||||
void radixSort(int bitround, int a[], int l, int r){
|
||||
int head[base] = {};
|
||||
int tail[base] = {};
|
||||
int cnt[base] = {};
|
||||
|
||||
if (bitround == -1 || l + 1 >= r) return;
|
||||
|
||||
{
|
||||
int i = l;
|
||||
|
||||
while (i < r){
|
||||
cnt[getNumPos(a[i], bitround)]
|
||||
= cnt[getNumPos(a[i], bitround)] + 1;
|
||||
i = i + 1;
|
||||
}
|
||||
head[0] = l;
|
||||
tail[0] = l + cnt[0];
|
||||
|
||||
i = 1;
|
||||
while (i < base){
|
||||
head[i] = tail[i - 1];
|
||||
tail[i] = head[i] + cnt[i];
|
||||
i = i + 1;
|
||||
}
|
||||
i = 0;
|
||||
while (i < base){
|
||||
while (head[i] < tail[i]){
|
||||
int v = a[head[i]];
|
||||
while (getNumPos(v, bitround) != i){
|
||||
int t = v;
|
||||
v = a[head[getNumPos(t, bitround)]];
|
||||
a[head[getNumPos(t, bitround)]] = t;
|
||||
head[getNumPos(t, bitround)] = head[getNumPos(t, bitround)] + 1;
|
||||
}
|
||||
a[head[i]] = v;
|
||||
head[i] = head[i] + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int i = l;
|
||||
|
||||
head[0] = l;
|
||||
tail[0] = l + cnt[0];
|
||||
|
||||
i = 0;
|
||||
while (i < base){
|
||||
if (i > 0){
|
||||
head[i] = tail[i - 1];
|
||||
tail[i] = head[i] + cnt[i];
|
||||
}
|
||||
radixSort(bitround - 1, a, head[i], tail[i]);
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int a[30000010];
|
||||
int ans;
|
||||
|
||||
int main(){
|
||||
int n = getarray(a);
|
||||
|
||||
starttime();
|
||||
|
||||
radixSort(8, a, 0, n);
|
||||
|
||||
int i = 0;
|
||||
while (i < n){
|
||||
ans = ans + i * (a[i] % (2 + i));
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
if (ans < 0)
|
||||
ans = -ans;
|
||||
stoptime();
|
||||
putint(ans);
|
||||
putch(10);
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,2 @@
|
||||
1352004184
|
||||
0
|
||||
@ -0,0 +1,110 @@
|
||||
int A[1024][1024];
|
||||
int B[1024][1024];
|
||||
int C[1024][1024];
|
||||
|
||||
int main() {
|
||||
int T = getint(); // 矩阵规模
|
||||
int R = getint(); // 重复次数
|
||||
|
||||
int i = 0;
|
||||
while (i < T) {
|
||||
if (i < T / 2) {
|
||||
getarray(A[i]);
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < T) {
|
||||
if (i >= T / 2) {
|
||||
getarray(B[i]);
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
starttime();
|
||||
|
||||
i = 0;
|
||||
while (i < T) {
|
||||
if (i >= T / 2) {
|
||||
int j = 0;
|
||||
while (j < T) {
|
||||
A[i][j] = -1;
|
||||
j = j + 1;
|
||||
}
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < T) {
|
||||
if (i < T / 2) {
|
||||
int j = 0;
|
||||
while (j < T) {
|
||||
B[i][j] = -1;
|
||||
j = j + 1;
|
||||
}
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < T) {
|
||||
int j = 0;
|
||||
while (j < T) {
|
||||
C[i][j] = A[i][j] * 2 + B[i][j] * 3;
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < T) {
|
||||
int j = 0;
|
||||
while (j < T) {
|
||||
int val = C[i][j];
|
||||
val = val * val + 7;
|
||||
val = val / 3;
|
||||
C[i][j] = val;
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < T) {
|
||||
int j = 0;
|
||||
while (j < T) {
|
||||
int k = 0;
|
||||
int sum = 0;
|
||||
while (k < T) {
|
||||
sum = sum + C[i][k] * A[k][j];
|
||||
k = k + 1;
|
||||
}
|
||||
A[i][j] = sum;
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
int total = 0;
|
||||
int r = 0;
|
||||
while (r < R) {
|
||||
i = 0;
|
||||
while (i < T) {
|
||||
int j = 0;
|
||||
while (j < T) {
|
||||
total = total + A[i][j] * A[i][j];
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
r = r + 1;
|
||||
}
|
||||
|
||||
stoptime();
|
||||
|
||||
putint(total);
|
||||
putch(10);
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,82 @@
|
||||
const int mod = 998244353;
|
||||
int d;
|
||||
|
||||
int multiply(int a, int b){
|
||||
if (b == 0) return 0;
|
||||
if (b == 1) return a % mod;
|
||||
int cur = multiply(a, b/2);
|
||||
cur = (cur + cur) % mod;
|
||||
if (b % 2 == 1) return (cur + a) % mod;
|
||||
else return cur;
|
||||
}
|
||||
|
||||
int power(int a, int b){
|
||||
if (b == 0) return 1;
|
||||
int cur = power(a, b/2);
|
||||
cur = multiply(cur, cur);
|
||||
if (b % 2 == 1) return multiply(cur, a);
|
||||
else return cur;
|
||||
}
|
||||
const int maxlen = 2097152;
|
||||
int temp[maxlen], a[maxlen], b[maxlen], c[maxlen];
|
||||
|
||||
int memmove(int dst[], int dst_pos, int src[], int len){
|
||||
int i = 0;
|
||||
while (i < len){
|
||||
dst[dst_pos + i] = src[i];
|
||||
i = i + 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
int fft(int arr[], int begin_pos, int n, int w){
|
||||
if (n == 1) return 1;
|
||||
int i = 0;
|
||||
while (i < n){
|
||||
if (i % 2 == 0) temp[i / 2] = arr[i + begin_pos];
|
||||
else temp[n / 2 + i / 2] = arr[i + begin_pos];
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
memmove(arr, begin_pos, temp, n);
|
||||
fft(arr, begin_pos, n / 2, multiply(w, w));
|
||||
fft(arr, begin_pos + n / 2, n / 2, multiply(w, w));
|
||||
i = 0;
|
||||
int wn = 1;
|
||||
while (i < n / 2){
|
||||
int x = arr[begin_pos + i];
|
||||
int y = arr[begin_pos + i + n / 2];
|
||||
arr[begin_pos + i] = (x + multiply(wn, y)) % mod;
|
||||
arr[begin_pos + i + n / 2] = (x - multiply(wn, y) + mod) % mod;
|
||||
wn = multiply(wn, w);
|
||||
i = i + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(){
|
||||
int n = getarray(a);
|
||||
int m = getarray(b);
|
||||
starttime();
|
||||
d = 1;
|
||||
while (d < n + m - 1){
|
||||
d = d * 2;
|
||||
}
|
||||
fft(a, 0, d, power(3, (mod - 1) / d));
|
||||
fft(b, 0, d, power(3, (mod - 1) / d));
|
||||
|
||||
int i = 0;
|
||||
while (i < d){
|
||||
a[i] = multiply(a[i], b[i]);
|
||||
i = i + 1;
|
||||
}
|
||||
fft(a, 0, d, power(3, mod-1 - (mod-1)/d));
|
||||
i = 0;
|
||||
while (i < d){
|
||||
a[i] = multiply(a[i], power(d, mod-2));
|
||||
i = i + 1;
|
||||
}
|
||||
stoptime();
|
||||
putarray(n + m - 1, a);
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
50 50 353434
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
.....................#..#.........................
|
||||
.....................#..#.........................
|
||||
...................##.##.##.......................
|
||||
.....................#..#.........................
|
||||
.....................#..#.........................
|
||||
...................##.##.##.......................
|
||||
.....................#..#.........................
|
||||
.....................#..#.........................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
@ -0,0 +1,51 @@
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
......................##..........................
|
||||
.....................####.........................
|
||||
....................#....#........................
|
||||
...................##....##.......................
|
||||
...................##....##.......................
|
||||
....................#....#........................
|
||||
.....................####.........................
|
||||
......................##..........................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
0
|
||||
@ -0,0 +1,112 @@
|
||||
int sheet1[500][500] = {};
|
||||
int sheet2[500][500] = {};
|
||||
int active = 1;
|
||||
int width;
|
||||
int height;
|
||||
int steps;
|
||||
|
||||
void read_map() {
|
||||
width = getint();
|
||||
height = getint();
|
||||
// width <= 498, height <= 498
|
||||
steps = getint();
|
||||
getch();
|
||||
|
||||
int i = 1;
|
||||
int j = 1;
|
||||
|
||||
while (j <= height) {
|
||||
i = 1;
|
||||
while (i <= width) {
|
||||
int get = getch();
|
||||
if (get == 35) {
|
||||
sheet1[j][i] = 1;
|
||||
} else {
|
||||
sheet1[j][i] = 0;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
// line feed
|
||||
getch();
|
||||
j = j + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void put_map() {
|
||||
int i = 1;
|
||||
int j = 1;
|
||||
|
||||
while (j <= height) {
|
||||
i = 1;
|
||||
while (i <= width) {
|
||||
if (sheet1[j][i] == 1) {
|
||||
putch(35);
|
||||
} else {
|
||||
putch(46);
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
// line feed
|
||||
putch(10);
|
||||
j = j + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void swap12() {
|
||||
int i = 1;
|
||||
int j = 1;
|
||||
|
||||
while (j <= height) {
|
||||
i = 1;
|
||||
while (i <= width) {
|
||||
sheet1[j][i] = sheet2[j][i];
|
||||
i = i + 1;
|
||||
}
|
||||
j = j + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void step(int source[][500], int target[][500]) {
|
||||
int i = 1;
|
||||
int j = 1;
|
||||
|
||||
while (j <= height) {
|
||||
i = 1;
|
||||
while (i <= width) {
|
||||
int alive_count = source[j - 1][i - 1] + source[j - 1][i] +
|
||||
source[j - 1][i + 1] + source[j][i - 1] +
|
||||
source[j][i + 1] + source[j + 1][i - 1] +
|
||||
source[j + 1][i] + source[j + 1][i + 1];
|
||||
if (source[j][i] == 1 && alive_count == 2 ) {
|
||||
target[j][i] = 1;
|
||||
} else if (alive_count == 3) {
|
||||
target[j][i] = 1;
|
||||
} else {
|
||||
target[j][i] = 0;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
j = j + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
read_map();
|
||||
starttime();
|
||||
while (steps > 0) {
|
||||
if (active == 1) {
|
||||
step(sheet1, sheet2);
|
||||
active = 2;
|
||||
} else {
|
||||
step(sheet2, sheet1);
|
||||
active = 1;
|
||||
}
|
||||
steps = steps - 1;
|
||||
}
|
||||
stoptime();
|
||||
if (active == 2) {
|
||||
swap12();
|
||||
}
|
||||
put_map();
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
50000000
|
||||
@ -0,0 +1,2 @@
|
||||
60255
|
||||
0
|
||||
@ -0,0 +1,331 @@
|
||||
int func(int n) {
|
||||
int sum = 0;
|
||||
int i = 200;
|
||||
int j = 0;
|
||||
int s[100];
|
||||
int m = 0;
|
||||
|
||||
while (m < 100){
|
||||
s[m] = 0;
|
||||
m=m+1;
|
||||
}
|
||||
while(j < n) {
|
||||
if (i > 1){
|
||||
s[1] = 1;
|
||||
if (i > 2){
|
||||
s[2] = 2;
|
||||
if (i > 3){
|
||||
s[3] = 3;
|
||||
if (i > 4){
|
||||
s[4] = 4;
|
||||
if (i > 5){
|
||||
s[5] = 5;
|
||||
if (i > 6){
|
||||
s[6] = 6;
|
||||
if (i > 7){
|
||||
s[7] = 7;
|
||||
if (i > 8){
|
||||
s[8] = 8;
|
||||
if (i > 9){
|
||||
s[9] = 9;
|
||||
if (i > 10){
|
||||
s[10] = 10;
|
||||
if (i > 11){
|
||||
s[11] = 11;
|
||||
if (i > 12){
|
||||
s[12] = 12;
|
||||
if (i > 13){
|
||||
s[13] = 13;
|
||||
if (i > 14){
|
||||
s[14] = 14;
|
||||
if (i > 15){
|
||||
s[15] = 15;
|
||||
if (i > 16){
|
||||
s[16] = 16;
|
||||
if (i > 17){
|
||||
s[17] = 17;
|
||||
if (i > 18){
|
||||
s[18] = 18;
|
||||
if (i > 19){
|
||||
s[19] = 19;
|
||||
if (i > 20){
|
||||
s[20] = 20;
|
||||
if (i > 21){
|
||||
s[21] = 21;
|
||||
if (i > 22){
|
||||
s[22] = 22;
|
||||
if (i > 23){
|
||||
s[23] = 23;
|
||||
if (i > 24){
|
||||
s[24] = 24;
|
||||
if (i > 25){
|
||||
s[25] = 25;
|
||||
if (i > 26){
|
||||
s[26] = 26;
|
||||
if (i > 27){
|
||||
s[27] = 27;
|
||||
if (i > 28){
|
||||
s[28] = 28;
|
||||
if (i > 29){
|
||||
s[29] = 29;
|
||||
if (i > 30){
|
||||
s[30] = 30;
|
||||
if (i > 31){
|
||||
s[31] = 31;
|
||||
if (i > 32){
|
||||
s[32] = 32;
|
||||
if (i > 33){
|
||||
s[33] = 33;
|
||||
if (i > 34){
|
||||
s[34] = 34;
|
||||
if (i > 35){
|
||||
s[35] = 35;
|
||||
if (i > 36){
|
||||
s[36] = 36;
|
||||
if (i > 37){
|
||||
s[37] = 37;
|
||||
if (i > 38){
|
||||
s[38] = 38;
|
||||
if (i > 39){
|
||||
s[39] = 39;
|
||||
if (i > 40){
|
||||
s[40] = 40;
|
||||
if (i > 41){
|
||||
s[41] = 41;
|
||||
if (i > 42){
|
||||
s[42] = 42;
|
||||
if (i > 43){
|
||||
s[43] = 43;
|
||||
if (i > 44){
|
||||
s[44] = 44;
|
||||
if (i > 45){
|
||||
s[45] = 45;
|
||||
if (i > 46){
|
||||
s[46] = 46;
|
||||
if (i > 47){
|
||||
s[47] = 47;
|
||||
if (i > 48){
|
||||
s[48] = 48;
|
||||
if (i > 49){
|
||||
s[49] = 49;
|
||||
if (i > 50){
|
||||
s[50] = 50;
|
||||
if (i > 51){
|
||||
s[51] = 51;
|
||||
if (i > 52){
|
||||
s[52] = 52;
|
||||
if (i > 53){
|
||||
s[53] = 53;
|
||||
if (i > 54){
|
||||
s[54] = 54;
|
||||
if (i > 55){
|
||||
s[55] = 55;
|
||||
if (i > 56){
|
||||
s[56] = 56;
|
||||
if (i > 57){
|
||||
s[57] = 57;
|
||||
if (i > 58){
|
||||
s[58] = 58;
|
||||
if (i > 59){
|
||||
s[59] = 59;
|
||||
if (i > 60){
|
||||
s[60] = 60;
|
||||
if (i > 61){
|
||||
s[61] = 61;
|
||||
if (i > 62){
|
||||
s[62] = 62;
|
||||
if (i > 63){
|
||||
s[63] = 63;
|
||||
if (i > 64){
|
||||
s[64] = 64;
|
||||
if (i > 65){
|
||||
s[65] = 65;
|
||||
if (i > 66){
|
||||
s[66] = 66;
|
||||
if (i > 67){
|
||||
s[67] = 67;
|
||||
if (i > 68){
|
||||
s[68] = 68;
|
||||
if (i > 69){
|
||||
s[69] = 69;
|
||||
if (i > 70){
|
||||
s[70] = 70;
|
||||
if (i > 71){
|
||||
s[71] = 71;
|
||||
if (i > 72){
|
||||
s[72] = 72;
|
||||
if (i > 73){
|
||||
s[73] = 73;
|
||||
if (i > 74){
|
||||
s[74] = 74;
|
||||
if (i > 75){
|
||||
s[75] = 75;
|
||||
if (i > 76){
|
||||
s[76] = 76;
|
||||
if (i > 77){
|
||||
s[77] = 77;
|
||||
if (i > 78){
|
||||
s[78] = 78;
|
||||
if (i > 79){
|
||||
s[79] = 79;
|
||||
if (i > 80){
|
||||
s[80] = 80;
|
||||
if (i > 81){
|
||||
s[81] = 81;
|
||||
if (i > 82){
|
||||
s[82] = 82;
|
||||
if (i > 83){
|
||||
s[83] = 83;
|
||||
if (i > 84){
|
||||
s[84] = 84;
|
||||
if (i > 85){
|
||||
s[85] = 85;
|
||||
if (i > 86){
|
||||
s[86] = 86;
|
||||
if (i > 87){
|
||||
s[87] = 87;
|
||||
if (i > 88){
|
||||
s[88] = 88;
|
||||
if (i > 89){
|
||||
s[89] = 89;
|
||||
if (i > 90){
|
||||
s[90] = 90;
|
||||
if (i > 91){
|
||||
s[91] = 91;
|
||||
if (i > 92){
|
||||
s[92] = 92;
|
||||
if (i > 93){
|
||||
s[93] = 93;
|
||||
if (i > 94){
|
||||
s[94] = 94;
|
||||
if (i > 95){
|
||||
s[95] = 95;
|
||||
if (i > 96){
|
||||
s[96] = 96;
|
||||
if (i > 97){
|
||||
s[97] = 97;
|
||||
if (i > 98){
|
||||
s[98] = 98;
|
||||
if (i > 99){
|
||||
s[99] = 99;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
j=j+1;
|
||||
int m = 0;
|
||||
while (m < 100){
|
||||
sum = sum + s[m];
|
||||
m=m+1;
|
||||
}
|
||||
sum = sum % 65535;
|
||||
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
starttime();
|
||||
int loopcount = getint();
|
||||
putint(func(loopcount));
|
||||
putch(10);
|
||||
stoptime();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -0,0 +1 @@
|
||||
4096
|
||||
@ -0,0 +1,2 @@
|
||||
0
|
||||
0
|
||||
@ -0,0 +1,49 @@
|
||||
|
||||
int COUNT = 500000;
|
||||
|
||||
float loop(float x[], float y[], int length) {
|
||||
int i = 0;
|
||||
float accumulator = 0.0;
|
||||
while (i < length) {
|
||||
accumulator = accumulator + x[i] * y[i];
|
||||
i = i + 1;
|
||||
}
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int i = 0, j = 0;
|
||||
int len = getint();
|
||||
float x[4096];
|
||||
float y[4096];
|
||||
float total = 0.0;
|
||||
float a = 0.0;
|
||||
float b = 1.0;
|
||||
starttime();
|
||||
while ( i < COUNT) {
|
||||
if (i % 10) {
|
||||
a = 0.0;
|
||||
b = 1.0;
|
||||
} else {
|
||||
a = a + 0.1;
|
||||
b = b + 0.2;
|
||||
}
|
||||
while ( j < len) {
|
||||
x[j] = a + j;
|
||||
y[j] = b + j;
|
||||
j = j + 1;
|
||||
}
|
||||
total = total + loop(x, y, len);
|
||||
i = i + 1;
|
||||
}
|
||||
stoptime();
|
||||
if ((total - 11442437121638400.000000) <=0.000001 || (total - 11442437121638400.000000) >= -0.000001) {
|
||||
putint(0);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
putint(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
10000000
|
||||
30 2 5 4 25 8 125 16 625 32 3125 2 5 4 25 8 125 16 625 32 3125 2 5 4 25 8 125 16 625 32 3125
|
||||
@ -0,0 +1,2 @@
|
||||
1042523985
|
||||
0
|
||||
@ -0,0 +1,51 @@
|
||||
int matrix[20000000];
|
||||
int a[100000];
|
||||
|
||||
int transpose(int n, int matrix[], int rowsize){
|
||||
int colsize = n / rowsize;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
while (i < colsize){
|
||||
j = 0;
|
||||
while (j < rowsize){
|
||||
if (i < j){
|
||||
j = j + 1;
|
||||
continue;
|
||||
}
|
||||
int curr = matrix[i * rowsize + j];
|
||||
matrix[j * colsize + i] = matrix[i * rowsize + j];
|
||||
matrix[i * rowsize + j] = curr;
|
||||
j = j + 1;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int main(){
|
||||
int n = getint();
|
||||
int len = getarray(a);
|
||||
starttime();
|
||||
int i = 0;
|
||||
while (i < n){
|
||||
matrix[i] = i;
|
||||
i = i + 1;
|
||||
}
|
||||
i = 0;
|
||||
while (i < len){
|
||||
transpose(n, matrix, a[i]);
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
int ans = 0;
|
||||
i = 0;
|
||||
while (i < len){
|
||||
ans = ans + i * i * matrix[i];
|
||||
i = i + 1;
|
||||
}
|
||||
if (ans < 0) ans = -ans;
|
||||
stoptime();
|
||||
putint(ans);
|
||||
putch(10);
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
1
|
||||
0
|
||||
@ -0,0 +1,85 @@
|
||||
int func(int i, int j) {
|
||||
return ((i+j) * (i+j+1) / 2 + i + 1);
|
||||
}
|
||||
|
||||
float Vectordot(float v[], float u[], int n) {
|
||||
int i = 0;
|
||||
float sum = 0;
|
||||
while (i < n) {
|
||||
sum =sum+ v[i] * u[i];
|
||||
i=i+1;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
void mult1(float v[], float out[],int n) {
|
||||
int i = 0, j = 0;
|
||||
float sum = 0;
|
||||
|
||||
while (i < n) {
|
||||
while (j < n) {
|
||||
sum =sum+ v[j] / func(i,j);
|
||||
j=j+1;
|
||||
}
|
||||
out[i] = sum;
|
||||
i=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
void mult2(float v[], float out[], int n) {
|
||||
int i = 0, j = 0;
|
||||
float sum = 0;
|
||||
|
||||
while (i < n) {
|
||||
while (j < n) {
|
||||
sum =sum+ v[j] / func(j,i);
|
||||
j=j+1;
|
||||
}
|
||||
out[i] = sum;
|
||||
i=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mult_combin(float v[], float out[], int n, float tmp[]) {
|
||||
mult1(v, tmp, n);
|
||||
mult2(tmp, out, n);
|
||||
}
|
||||
|
||||
float temp = 1;
|
||||
float my_sqrt(float input) {
|
||||
while (temp - input / temp > 1e-6 || temp - input / temp < -1e-6){
|
||||
temp = (temp+input/temp)/2;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int n = 100000;
|
||||
if (n <= 0) {
|
||||
n = 2000;
|
||||
}
|
||||
starttime();
|
||||
float vectorA[100000], vectorB[100000], Vectortmp[100000];
|
||||
|
||||
int i;
|
||||
while(i < n) {
|
||||
vectorA[i] = 1;
|
||||
i=i+1;
|
||||
}
|
||||
i = 0;
|
||||
while(i < 1000) {
|
||||
mult_combin(vectorA, vectorB, n, Vectortmp);
|
||||
mult_combin(vectorB, vectorA, n, Vectortmp);
|
||||
i=i+1;
|
||||
}
|
||||
stoptime();
|
||||
float result = my_sqrt(Vectordot(vectorA,vectorB, n) / Vectordot(vectorB,vectorB,n));
|
||||
if(result - 1.000000 <= 1e-6 && result - 1.000000 >= -1e-6){
|
||||
putint(1);
|
||||
}else{
|
||||
putint(0);
|
||||
}
|
||||
putch(10);
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in new issue