社区讨论

求hack数据

学术版参与者 3已保存回复 4

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
4 条
当前快照
1 份
快照标识符
@mhjh4fb9
此快照首次捕获于
2025/11/04 02:28
4 个月前
此快照最后确认于
2025/11/04 02:28
4 个月前
查看原帖
https://www.luogu.com.cn/problem/B3711
CPP
#include<bits/stdc++.h>
#define int long long
using namespace std;
bool check(string s){
    int x=0,u=s.size();
    if(!u) return false;
    for(int i=0;i<u;i++) x=x*10+s[i]-'0';
    return !(x%4);
}
string k(string s,int l,int r){
    int u=s.size();
    string s1=s.substr(0,l),s2=s.substr(r+1);
    return s1+s2;
}
signed main(){
    int t;
    string n;
    cin>>t;
    while(t--){
        cin>>n;
        if(check(n)){cout<<"Yes";continue;}
        int v=n.size();
        bool f=0;
        for(int i=0;i<v;i++){
            for(int j=i;j<v;j++){
                string p=k(n,i,j);
                if(check(p)){f=1;break;}
            }
        }
        if(f) cout<<"Yes";
        else cout<<"No";
        cout<<endl;
    }
    return 0;
}
WA 10pts , AC on #4 .

回复

4 条回复,欢迎继续交流。

正在加载回复...