按理说 Mono 应该兼容 C# 阿
但是这个程序本地 cs 过得去,洛谷的 mono 就报 CE,求助怎么改
int read() {
char c = (char)Console.Read();
int s = 0, f = 1;
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = (char)Console.Read();
}
while (c >= '0' && c <= '9') {
s = (s << 1) + (s << 3) + c - 48;
c = (char)Console.Read();
}
return s * f;
}
int n = read();
int[] a = new int[n + 5];
for (int i = 1; i <= n; i++) a[i] = read();
int[] sum = new int[n + 5];
for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
int T = read();
while (T-- != 0) {
int x = read(), y = read();
Console.WriteLine(sum[y] - sum[x - 1]);
}
因为 cs 的输入太 shit 所以自己写的输入
报错:
error CS1525: Unexpected symbol `int'
顺便问洛谷为什么不支持纯 cs