Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
10 张宸瑞 部分排序 C++ Compile Error 0 MS 0 KB 807 2022-07-15 09:00:44

Tests(0/0):


Code:

#include <iostream> #include <algorithm> #include <cstring> using namespace std; int a[110],b[110],last[110];//a为输入的元是数组,b为纪录当下数组,last为上一次的数组。 int n,k; bool check(int x[],int y[]){ for(int i=0;i<n;i++){ if(x[i]!=y[i]){ return false; } return ture; } } int main() { cin>>n>>k; for(int i=0;i<n;i++){ cin>>a[i]; } memcpy(last,a,sizeof,a);//将a数组复制到last数组中。 int sum=0; sort(p2+i;p2+i+k); for(int i=0;i<=n-k;i++){ memcpy(b,a,sizeof,b); sort(b+i,b+i+k);//sort(b+i是起到,b+i+k是终点) if(!check(last,b)){ sum++; } memcpy(last,b,sizeof,b); } cout<<sum; return 0; }


Run Info:

Main.cc: In function 'bool check(int*, int*)':
Main.cc:12:16: error: 'ture' was not declared in this scope
         return ture;
                ^
Main.cc: In function 'int main()':
Main.cc:21:25: error: expected primary-expression before ',' token
     memcpy(last,a,sizeof,a);//将a数组复制到last数组中。
                         ^
Main.cc:23:10: error: 'p2' was not declared in this scope
     sort(p2+i;p2+i+k);
          ^
Main.cc:23:13: error: 'i' was not declared in this scope
     sort(p2+i;p2+i+k);
             ^
Main.cc:23:21: error: expected ';' before ')' token
     sort(p2+i;p2+i+k);
                     ^
Main.cc:25:26: error: expected primary-expression before ',' token
         memcpy(b,a,sizeof,b);
                          ^
Main.cc:30:29: error: expected primary-expression before ',' token
         memcpy(last,b,sizeof,b);
                             ^
Main.cc: In function 'bool check(int*, int*)':
Main.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^