Help! Why CE?

P3952 [NOIP2017 提高组] 时间复杂度

i没定义
by Hongzixuan0922 @ 2023-01-09 12:51:03


``` for(i=0;i<k;++i) ``` i在那里定义的?
by EasonX @ 2023-01-09 13:22:52


@[liuhaodong2021](/user/602624) 一些问题: - 14 行 ```i``` 未定义; - 20 行缺少一个右括号; - 39 行(11 行)的 $\texttt{f}$ 函数缺少 ```k```。 给您把除了第 3 个问题改正后的 code 发出来: ```cpp #include<cstdio> #include<string> #include<iostream> #include<sstream> #define max(a,b) ((a)>(b)?(a):(b)); using namespace std; string tmp,t; int F; int Vis[256]; char bl, st, en; inline string f(int k) { F = 0; int R = 0; for(int i=0;i<k;++i) { getline(cin, tmp); if (tmp[0] == 'F') { sscanf(tmp.c_str(), "F %c %s", &bl, t.c_str()); if( ! ( isdigit ( t [ 0 ] ) && isdigit ( t [ t.size() - 1 ] ) )) ++R; if (Vis[bl])return "ERR"; } } if (R) { stringstream Str; Str << "O(n^" << R << ")"; return Str.str(); } else return"O(1)"; } int main(void) { int q,T; ios::sync_with_stdio(false); cin >> q; while (q--) { string He; cin >> T >> He; // tmp = f(); 这一行我不知道您要写什么,所以注释了。 if (tmp == "ERR")printf("ERR\n"); else if (tmp == He)printf("Yes\n"); else printf("No\n"); } } ```
by srds_cbddl @ 2023-01-09 13:26:02


|