code wiki / (root) / sj_live_ng2.nx

sj_live_ng2.nx source

↩ module page · 68 lines · 2221 B

1// GENERATED by nx_symjudge -- sweep harness, do not edit 2import "nx_syscalls.nx" 3func neg(x: i64) -> i64 { return 0 - x } 4func sjh_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 5func sjh_nl() -> i64 { let b: *u8 = sys_mmap(8); b[0] = 10 as u8; sys_write(1, b, 1); return 0 } 6func sjh_n(v: i64) -> i64 { 7 var m: i64 = v 8 if m < 0 { let nb: *u8 = sys_mmap(8); nb[0] = 45 as u8; sys_write(1, nb, 1); m = 0 - m } 9 let t: *u8 = sys_mmap(24) 10 var k: i64 = 0 11 if m == 0 { t[0] = 48 as u8; k = 1 } 12 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 13 let ob: *u8 = sys_mmap(24) 14 var i: i64 = 0 15 while i < k { ob[i] = t[k - 1 - i]; i = i + 1 } 16 sys_write(1, ob, k) 17 return 0 18} 19func main() -> i64 { 20 var viol: i64 = 0 21 var checked: i64 = 0 22 var vrep: i64 = 0 23 let anch3: i64 = neg(1) 24 if anch3 != (0 - 1) { viol = viol + 1 25 if vrep == 0 { vrep = 1 26 sjh_w("SYMJVIOL anchor x=" as *u8) 27 sjh_n(1) 28 sjh_w(" r=" as *u8) 29 sjh_n(anch3) 30 sjh_nl() } } 31 var x: i64 = (0 - 600) 32 while x <= 600 { 33 let r: i64 = neg(x) 34 let rn0: i64 = neg(0 - x) 35 if rn0 != (0 - r) { viol = viol + 1 36 if vrep == 0 { vrep = 1 37 sjh_w("SYMJVIOL odd x=" as *u8) 38 sjh_n(x) 39 sjh_w(" r=" as *u8) 40 sjh_n(r) 41 sjh_nl() } } 42 if x >= (0 - 300) { if x <= 300 { let rl1: i64 = neg(x + x) 43 if rl1 != (r + r) { viol = viol + 1 44 if vrep == 0 { vrep = 1 45 sjh_w("SYMJVIOL lin2 x=" as *u8) 46 sjh_n(x) 47 sjh_w(" r=" as *u8) 48 sjh_n(r) 49 sjh_nl() } } 50 } } 51 if x == 0 { if r != 0 { viol = viol + 1 52 if vrep == 0 { vrep = 1 53 sjh_w("SYMJVIOL fix0 x=" as *u8) 54 sjh_n(x) 55 sjh_w(" r=" as *u8) 56 sjh_n(r) 57 sjh_nl() } } 58 } 59 checked = checked + 1 60 x = x + 1 61 } 62 sjh_w("SYMJ neg checked=" as *u8) 63 sjh_n(checked) 64 sjh_w(" viol=" as *u8) 65 sjh_n(viol) 66 sjh_nl() 67 return 0 68}