2 条题解

  • 0
    @ 2026-5-2 8:28:26

    ^ | lllll

    #define LL long long
    using namespace std;
    const int N = 510;
    int n,m;
    int a[N][N];
    int main(){
        cin>>n>>m;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                cin>>a[i][j];
            }
        }
        int ans=0;
        for(int i=1;i<=n-1;i++){
            for(int j=1;j<=m-1;j++){
                if(1LL*a[i][j]*a[i+1][j+1]==1LL*a[i][j+1]*a[i+1][j]){
                    ans++;
                }
            }
        }
        cout<<ans<<endl;
        return 0;
    }
    //:)
    //114514
    
    
    • 0
      @ 2026-4-5 22:20:29

      虽然只有一种味道,但真的很 鲜~

      葵花籽味

      #include<bits/stdc++.h>
      using namespace std;
      int n, m;
      int a[505][505];
      int ans = 0;
      int main() {
          cin >> n >> m;
          for(int i = 1; i <= n; i++) { //输入
              for(int j = 1; j <= m; j++) {
                  cin >> a[i][j];
              }
          }
          for(int i = 1; i < n; i++) { //循环判断是否为好子矩阵
              for(int j = 1; j < m; j++) {
                  if (a[i][j]*a[i + 1][j + 1] == a[i + 1][j]*a[i][j + 1]) {
                      ans++;
                  }
              }
          }
          cout << ans;
          return 0;
      }
      
      
      冷知识,在洛谷这道题只能算是个“入门”!
      • 1

      信息

      ID
      3300
      时间
      1000ms
      内存
      256MiB
      难度
      5
      标签
      递交数
      104
      已通过
      40
      上传者