← 查看本卷题目GESP C++ 4级2026年3月单选题 第12题 · 2 分下列代码段的时间复杂度为( )。 1 int cnt=0;2 for(int i=0; i<n; i++){3 for(int j=0; j<n; j++){4 if( (i+j) % 3 == 0) cnt++;5 }6 }填写答案AO(n)O(n)O(n)BO(nlogn)O(n \log n)O(nlogn)CO(n2)O(n^2)O(n2)DO(2n)O(2^n)O(2n)提交答案详细解析这题不会 ← 上一题 第 66 / 378 题← → 键切题 下一题 →
下列代码段的时间复杂度为( )。 1 int cnt=0;2 for(int i=0; i<n; i++){3 for(int j=0; j<n; j++){4 if( (i+j) % 3 == 0) cnt++;5 }6 }填写答案AO(n)O(n)O(n)BO(nlogn)O(n \log n)O(nlogn)CO(n2)O(n^2)O(n2)DO(2n)O(2^n)O(2n)提交答案详细解析这题不会