10/29 12nd.CPS-J

· · 个人记录

::::info[I] :::info[problem] ::: :::success[AC code]

#include<bits/stdc++.h>
using namespace std;
int main(){
    freopen("keynegative.in","r",stdin);
    freopen("keynegative.out","w",stdout);
    string s;
    cin>>s;
    if(s[0]=='0') cout<<s;
    else {cout<<1;for(char c:s.substr(1,s.length()-1)) cout<<(c=='0'?'1':'0');}
    return 0;
}

::: :::error[WRONG code] NOTHING ::: :::warning[cause of death] NOTHING ::: ::::

::::info[II] :::info[problem] ::: :::success[AC code]

#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    freopen("conveyorchecksum.in","r",stdin);
    freopen("conveyorchecksum.out","w",stdout);
    int n,m,q,sum=0;
    cin>>n>>m;
    vector<int> a(2*n),b(2*n);
    for(int i=1;i<=n;i++){
        cin>>a[i];
        a[i+n]=a[i];
        q=a[i];
        q^=a[i-1];
        sum+=q;
    }
    int id=0;
    q=a[1];
    q^=a[n];
    cout<<sum-q<<' ';   
    for(int i=1;i<=m;i++){
        int x;
        cin>>x;
        id+=x;
        id%=n;
        if(id==0) q=a[1]^a[n];
        else {q=a[n-id];q^=a[n-id+1];}
        cout<<sum-q<<' '<<endl; 
    }
    return 0;
}

::: :::error[WA code ]

include<bits/stdc++.h>

using namespace std;

define int long long

signed main(){ freopen("conveyorchecksum.in","r",stdin); freopen("conveyorchecksum.out","w",stdout); int n,m,q,sum=0; cin>>n>>m; vector<int> a(n+1),b(m+1); for(int i=1;i<=n;i++){ cin>>a[i]; if(i!=1){ q=a[i]; q^=a[i-1]; sum+=q; //cout<<a[i-1]<<' '<<a[i]<<' '<<q<<endl; } } sum+=a[1]^a[n]; int id=0; q=a[1]; q^=a[n]; // cout<<a[n]<<' '<<a[1]<<' '<<q<<endl; cout<<sum-q<<' ';
for(int i=1;i<=m;i++){ int x; cin>>x; id+=x; id%=n; if(id==0) q=a[1]^a[n]; else {q=a[n-id];q^=a[n-id+1];} cout<<sum-q<<' '<<endl; } return 0; } /5 5 10 13 2 5 6 4 1 5 1 2 / ::: :::warning[cause of death] 环状计算错误 ::: :::: :::::info[III] :::info[problem] ::: :::success[AC code]

::: ::::error[WA code ] :::error[TLE code1 0']

::: :::error[WA code2 90']

:::
:::warning[cause of death ]
1
:::

::::info[IV]

:::info[problem]

::: :::success[AC code]

::: :::error[WA code (') ]

::: :::warning[cause of death ]

:::