QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#353642#8340. 3 Sumucup-team004#WA 0ms3832kbC++20975b2024-03-14 14:19:072024-03-14 14:19:11

Judging History

你现在查看的是最新测评结果

  • [2024-09-20 10:20:30]
  • hack成功,自动添加数据
  • (/hack/848)
  • [2024-03-18 21:48:05]
  • hack成功,自动添加数据
  • (/hack/579)
  • [2024-03-18 21:45:33]
  • hack成功,自动添加数据
  • (/hack/578)
  • [2024-03-14 14:19:11]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3832kb
  • [2024-03-14 14:19:07]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n,k,ans;
const int N=505;
const ll mod=(ll)(1e17)+7;
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
ll a[N];
ll get(string s){
    reverse(s.begin(),s.end());
    ll sum=0;
    vector<int> a(k+1);
    For(i,0,k-1)for(int j=i;j<s.length();j+=k){
        a[i]+=s[j]-'0';
    }
    do{for(int i=0;i<k;i++){a[i+1]+=a[i]/10; a[i]%=10;} a[0]=a[k]; a[k]=0;}
    while(a[0]>=10);
    For(i,0,k-1)sum=(sum*10+a[i])%mod;
    return sum;
}
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cin>>n>>k;
    For(i,0,n-1){
        string s;
        cin>>s;
        a[i]=get(s);
        //cerr<<a[i]<<endl;
    }
    ll ald=0;
    For(i,0,k-1)ald=(ald*10+9)%mod;
    For(i,0,n-1)For(j,i,n-1)For(k,j,n-1){
        ll t=(a[i]+a[j]+a[k])%mod;
        if(t==ald||t==0||t==ald*2%mod||t==ald*3%mod)ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3832kb

input:

4 1
0
1
10
17

output:

20

result:

wrong answer 1st numbers differ - expected: '3', found: '20'