QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#537096#8340. 3 SumhzjoiinegCompile Error//C++201.2kb2024-08-29 20:21:392024-08-29 20:21:40

Judging History

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

  • [2024-09-20 10:20:30]
  • hack成功,自动添加数据
  • (/hack/848)
  • [2024-08-29 20:21:40]
  • 评测
  • [2024-08-29 20:21:39]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i, j, k) for(int i=j;i<=(k);i++)
#define rep1(i, j, k) for(int i=k;i>=(j);i--)
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define ft first
#define sd second

using namespace std;

const int N=5e2+5, M=2e4+5, mod[3]={998244353, 1e9+7, 1e9+9};
int n, k, ans;
string x;
map<int, int> mp[3];
ll s[3][N], t[3], m[3], m2[3];
vector<int> a;
bool p(int num, int i){
	return !(num==0 || num==m[i] || num==m2[i]);
}
bool chk(int x, int y, int z){
	rep(i, 0, 2) if(p((s[i][x]+s[i][y]+s[i][z])%mod[i], i)) return 0;
	return 1;
}

int main(){
//	freopen("manzanita.in", "r", stdin);
//	freopen("manzanita.out", "w", stdout);
	
	scanf("%d%d", &n, &k);
	rep(i, 1, n){
		cin>>x; reverse(x.begin(), x.end());
		a.assign(k, 0);
		rep(j, 0, (int) x.size()-1) a[j%k]+=x[j]-'0';
		int c=0;
		do for(auto &x : a) c+=x, x=c%10, c/=10; while(c);
		reverse(a.begin(), a.end());
		if(*min_element(a.begin(), a.end())!=9)
		for(auto x : a) rep(l, 0, 2) s[l][i]=(s[l][i]*10+x)%mod[l];
	}
	while(k--) rep(i, 0, 2) m[i]=(m[i]*10+9)%mod[i];
	rep(i, 0, 2) m2[i]=(m[i]*2)%mod[i];
	rep(i, 1, n) rep(j, i, n) rep(k, j, n) ans+=chk(i, j, k);
	printf("%d\n", ans);
	return 0;
}

詳細信息

answer.code:12:51: error: narrowing conversion of ‘1.000000007e+9’ from ‘double’ to ‘int’ [-Wnarrowing]
   12 | const int N=5e2+5, M=2e4+5, mod[3]={998244353, 1e9+7, 1e9+9};
      |                                                ~~~^~
answer.code:12:58: error: narrowing conversion of ‘1.000000009e+9’ from ‘double’ to ‘int’ [-Wnarrowing]
   12 | const int N=5e2+5, M=2e4+5, mod[3]={998244353, 1e9+7, 1e9+9};
      |                                                       ~~~^~
answer.code: In function ‘int main()’:
answer.code:30:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |         scanf("%d%d", &n, &k);
      |         ~~~~~^~~~~~~~~~~~~~~~