2 条题解

  • 1
    @ 2025-4-20 13:21:20
    //#885. 图像相似度
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int m,n;
        cin>>m>>n;
        int tp1[m][n];
        int tp2[m][n];
        for(int i=0;i<m;++i){
            for(int j=0;j<n;++j){
                cin>>tp1[i][j];
            }
        }
        for(int i=0;i<m;++i){
            for(int j=0;j<n;++j){
                cin>>tp2[i][j];
            }
        }
        int sl=0;
        for(int i=0;i<m;++i){
            for(int j=0;j<n;++j){
                if(tp1[i][j]==tp2[i][j]){
                    sl++;
                }
            }
        }
        double dx=m*n;
        double bfb=(sl/dx)*100;
        cout<<fixed<<setprecision(2)<<bfb<<endl;
        return 0;
    }
    
    • 0
      @ 2025-1-20 22:18:54
      #include<bits/stdc++.h>
      using namespace std;
      long long a1[2000][2000],a2[2000][2000];
      int main(){
      	long long s1,s2;
      	double d=0,d1=0;
      	cin>>s1>>s2;
      	for(int i=1;i<=s1;i++){
      		for(int j=1;j<=s2;j++){
      			cin>>a1[i][j];
      		}
      	}
      	for(int i=1;i<=s1;i++){
      		for(int j=1;j<=s2;j++){
      			cin>>a2[i][j];
      		}
      	}
      	for(int i=1;i<=s1;i++){
      		for(int j=1;j<=s2;j++){
      			d1++;
      			if(a1[i][j]==a2[i][j]){
      				d++;
      			}
      		}
      	}
      	printf("%.2lf",d/d1*100);
      	return 0;
      }
      
      
      • 1

      信息

      ID
      885
      时间
      1000ms
      内存
      128MiB
      难度
      10
      标签
      (无)
      递交数
      5
      已通过
      4
      上传者