QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#534137 | #8340. 3 Sum | Forza_Ferrari | Compile Error | / | / | C++14 | 1.5kb | 2024-08-26 21:05:52 | 2024-08-26 21:05:52 |
Judging History
你现在查看的是最新测评结果
- [2024-09-20 10:20:30]
- hack成功,自动添加数据
- (/hack/848)
- [2024-08-26 21:05:52]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-08-26 21:05:52]
- 提交
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<map>
#include<random>
#include<chrono>
using namespace std;
#define int long long
int n,m,ans,cnt;
const int mod=(long long)(1e17)+9;
string s;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int w[501],a[20005];
inline int solve(string x)
{
for(int i=0;i<m;++i)
{
a[i]=0;
for(int j=i;j<x.length();j+=m)
a[i]+=x[j]-'0';
}
for(;a[0]>=10;)
{
for(int j=0;j<m;++j)
{
a[j+1]+=a[j]/10;
a[j]%=10;
}
a[0]+=a[k];
a[k]=0;
}
int res=0;
for(int j=m-1;j>=0;--j)
res=(1ll*res*10%mod+a[j])%mod;
return res;
}
inline void solve()
{
int val1=0,val2=0,val3=0;
for(int i=1;i<=m;++i)
val1=(10ll*val1%mod+9)%mod;
val2=(val1+val1)%mod,val3=(val1+val2)%mod;
for(int i=1;i<=n;++i)
for(int j=i;j<=n;++j)
for(int k=j;k<=n;++k)
ans+=(w[i]+w[j]+w[k])%mod==0||(w[i]+w[j]+w[k])%mod==val1||(w[i]+w[j]+w[k])%mod==val2||(w[i]+w[j]+w[k])%mod==val3;
}
inline void init()
{
ios::sync_with_stdio(0);
cin.tie(0);
}
signed main()
{
init();
cin>>n>>m;
for(int i=1;i<=n;++i)
{
cin>>s;
reverse(s.begin(),s.end());
w[i]=solve(s);
}
solve();
cout<<ans<<'\n';
cout.flush();
return 0;
}
详细
answer.code: In function ‘long long int solve(std::string)’: answer.code:31:17: error: ‘k’ was not declared in this scope 31 | a[0]+=a[k]; | ^