AC

许许  •  30天前


include <bits/stdc++.h>

using namespace std; int mouse(int a,int b,int c){

int t=a;
if(t==b){
	return 1; 
}else{
	return c-a+b/t;
}

} int rice(int q){

if(q>0){
	return q;
}if(q==0){
	return -1;
}else{
	int r;
	r=-q;
	return r;
}

} int main() {

int a, b,f,q,n;
cin >> a >> b>>n;
int f;
q=rice(n);
f=mouse(a,b,q);
cout<<f-q;
return 0;

}


评论:

include<bits/stdc++.h>

using namespace std;

const int N=11;

const int mod=10;

int a[N][N][N][N][N];

int main(){

int n;
cin>>n;
for(int i=1;i<=n;i++){
	int b,c,d,e,f;
	cin>>b>>c>>d>>e>>f;
	for(int j=1;j<=9;j++){
		a[(b+j)%mod][c][d][e][f]++; 
		a[b][(c+j)%mod][d][e][f]++; 
		a[b][c][(d+j)%mod][e][f]++; 
		a[b][c][d][(e+j)%mod][f]++; 
		a[b][c][d][e][(f+j)%mod]++; 
		a[(b+j)%mod][(c+j)%mod][d][e][f]++; 
		a[b][(c+j)%mod][(d+j)%mod][e][f]++; 
		a[b][c][(d+j)%mod][(e+j)%mod][f]++; 
		a[b][c][d][(e+j)%mod][(f+j)%mod]++; 
	} 
}
int cnt=0;
for(int i=0;i<=9;i++){
	for(int j=0;j<=9;j++){
		for(int k=0;k<=9;k++){
			for(int u=0;u<=9;u++){
				for(int v=0;v<=9;v++){
					if(a[i][j][k][u][v]==n) cnt++;
				}
			}
		}
	}
}
cout<<cnt;
return 0;

}


鑫鑫  •  18天前

请先登录,才能进行评论