A 1478
B 4
代码如下:
#include
using namespace std;
int main()
{
int a[100]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int i,j,k,s=0;
for(i=1;i<=12;i++){
for(j=1;j<=a[i];j++){
int t=j;k=i;
int s1,s2,s3,s4;
s1=i/10,s2=i%10;
s3=t/10,s4=t%10;
if(s3-1==s2&&s2-1==s1&&s1!=0){
s++;
cout<<i<<j<<endl;
}else if(s4-1==s3&&s3-1==s2&&s2!=0) {
cout<<i<<j<<endl;
s++;
}
}
}
cout<<s;
}
int a,b,n,i,j,k,s=0;
scanf("%d%d%d",&a,&b,&n);
for(i=1;;i++){
if(i%7==0||i%7==6){
s+=b;
}else{
s+=a;
}
if(s>=n){
break;
}
}
cout<<i<<endl;
int i,j,k,n;
scanf("%d",&n);
if(n%2==0){
k=n*2;
for(i=1;i<=n/2;i++){
k-=2;
printf("%d ",k);
}
for(;i<=n;i++){
printf("%d ",k);k+=2;
}
}else{
k=n*2;
for(i=1;i<=n/2+1;i++){
k-=2;
printf("%d ",k);
}
for(;i<=n;i++){
k+=2;
printf("%d ",k);
}
}
return 0;
#include
using namespace std;
long long a[1010][1010];
int main()
{
int i,j,k,m,n;
scanf("%d%d%d",&n,&m,&k);
for(i=0;i<=n;i++)
for(j=0;j<=m;j++)
a[i][j]=INT_MAX;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
scanf("%d",&a[i][j]);
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
a[i][j]=a[i][j]+a[i-1][j]+a[i][j-1]-a[i-1][j-1];
long long sum=0;
int x,y;
for(x=1;x<=n;x++)
for(y=1;y<=m;y++)
for(i=x;i<=n;i++)
for(j=y;j<=m;j++)
if(a[i][j]-a[i-x][j]-a[i][j-y]+a[i-x][j-y]<=k)
sum++;
printf("%lld\n",sum);
return 0;
}