编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#22727 #1119. Rhodoks的2-sum问题 Compile Error 0 0 ms 0 K Python 3 / 684 B Albot 2020-02-13 22:30:02
#include<bits/stdc++.h>
using namespace std;

int judge(vector<int> arr,int end,int K){
    int i=0;
    int j = end -1;
    while(i<j){
        if(arr[i]+arr[j] < K){
            i += 1;
            }
        else if(arr[i]+arr[j] > K){
            j -= 1;
            }
        else
        {
            printf("Yes\n");
            return 1;
            }
    }
    printf("No\n");
    return 0;
}

int main(){
    int judge(vector<int> arr,int end,int K);
    int n,k;
    cin>>n>>k;
    vector<int> a;
    for(int i=0;i<n;i++){
        int t = 0;
        cin >> t;
        a.push_back(t);
    }
    sort(a.begin(),a.end());
    judge(a,n,k);
}

编译信息

  File "a.py", line 2
    using namespace std;
          ^
SyntaxError: invalid syntax