万紫没红

P3397 地毯

zzgj1235 @ 2024-09-24 21:24:40

0分!

#include<bits/stdc++.h>
using namespace std;
int a[1005][1005];
int main(){
    memset(a,0,sizeof(a));
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        int x1,y1,x2,y2;
        scanf("%d%d%d%d",x1,y1,x2,y2);
        for(int j=x1;j<=x2;j++){
            for(int k=y1;k<=y2;k++){
                a[j][k]++;
            }
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            printf("%d ",a[i][j]);
        }
        printf("\n");
    }
    return 0;
}

by 潘德理2010 @ 2024-09-24 21:27:31

谁允许你把 y1 作为变量名了?


by zh_felix @ 2024-09-24 21:29:08

@zzgj1235 y1 是某个库里的函数


by zzgj1235 @ 2024-09-24 21:29:22

@潘德理2010 ???


by Segment_Treap @ 2024-09-24 21:29:45

@zzgj1235 y1 是库函数


by zzgj1235 @ 2024-09-24 21:31:49

@Li_Hulian 改了but RE


by zh_felix @ 2024-09-24 21:32:30

还有 scanf 的后面的几个参数要加 &


by Segment_Treap @ 2024-09-24 21:33:22

scanf("%d",&a);


by zzgj1235 @ 2024-09-24 21:33:24

@zh_felix 加了


by zzgj1235 @ 2024-09-24 21:33:56

@Li_Hulian @zh_felix 80分???


by zzgj1235 @ 2024-09-24 21:34:22

1,2 WA


| 下一页