I don't know why I can't use C ++ for input and output, but I just need to change it to C... # Include <stdio. h> # include <string. h> // ============================================#define maxn 50020 int c [maxn]; int a [maxn]; int n; int t; int lowbit (int x) {return x & (-x) ;}int Sum (int n) {int sum = 0; while (n> 0) {sum + = c [n]; n = n-lowbit (n);} return sum;} void update (int I, int x) {while (I <= n) {c [I] = c [I] + x; I = I + lowbit (I) ;}} int GetSum (int x1, int x2) {return Sum (x2)-Sum (x1-1 );} // ==================================================== int main () {scanf ("% d", & t); int count = 0; while (t --) {count ++; memset (a, 0, sizeof ()); memset (c, 0, sizeof (c); scanf ("% d", & n); for (int I = 1; I <= n; I ++) {scanf ("% d", & a [I]); update (I, a [I]);} // cout <"case" <count <":" <endl; printf ("Case % d: \ n", count); char limit [11]; int I, j; while (scanf ("% s", threads) = 1) {if (strcmp (threads, "End") = 0) break; scanf ("% d", & I, & j); if (strcmp (latency, "Query") = 0) {printf ("% d \ n ", getSum (I, j);} if (strcmp (random, "Add") = 0) {a [I] + = j; update (I, j );} if (strcmp (separator, "Sub") = 0) {a [I]-= j; update (I,-j) ;}} return 0 ;}