From 4022e5c95210631e4aceb08eaf9d9071aa5aefc4 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Tue, 15 Sep 2026 08:16:43 +0800 Subject: Set up a git repo --- tests/performance/08_floyd.sy | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/performance/08_floyd.sy (limited to 'tests/performance/08_floyd.sy') diff --git a/tests/performance/08_floyd.sy b/tests/performance/08_floyd.sy new file mode 100644 index 0000000..30db367 --- /dev/null +++ b/tests/performance/08_floyd.sy @@ -0,0 +1,45 @@ +const int N = 1024; +int dist[N][N]; + +int main() { + int n = getint(); + int i, j; + i = 0; + while (i < n) { + j = 0; + while (j < n) { + dist[i][j] = getint(); + j = j + 1; + } + i = i + 1; + } + + int k = 0; + while (k < n) { + i = 0; + while (i < n) { + j = 0; + while (j < n) { + if (dist[i][k] + dist[k][j] < dist[i][j]) { + dist[i][j] = dist[i][k] + dist[k][j]; + } + j = j + 1; + } + i = i + 1; + } + k = k + 1; + } + + + i = 0; + while (i < n) { + j = 0; + while (j < n) { + putint(dist[i][j]); + putch(32); + j = j + 1; + } + i = i + 1; + } + return 0; +} \ No newline at end of file -- cgit v1.2.3