5 solutions

  • 5
    @ 2025-4-26 19:52:53

    #include<bits/stdc++.h> using namespace std; int n, m, k; int a[1005][1005]; bool r[1005], c[1005]; // 分别记录行和列是否被轰炸

    struct node{ int val,x,y; }e[1000005];

    bool cmp(node a,node b) { return a.val > b.val; } int main() { cin >> n >> m >> k; int cnt = 0; for(int i = 1 ; i <= n ; i++) { for(int j = 1 ; j <= m ; j++) { cin >> a[i][j]; e[++cnt] = {a[i][j],i,j}; } } queue<pair<int,int> >q; sort(e+1,e+1+cnt,cmp); //cout<<cnt<<endl; for(int i = 1 ; i <= cnt ; i ++) { q.push({e[i].x,e[i].y}); } int sum = 0; while(!q.empty()) { int u = q.front().first; int v = q.front().second; q.pop(); if(r[u] || c[v]) continue; if(sum == k) break; sum++;

    	r[u] = 1;
    	c[v] = 1;
    }
    for(int i = 1 ; i <= n ; i++)
    {
    	if(r[i]) continue;
    	for(int j = 1 ; j <= m ; j++ )
    	{
    		if(!c[j])
    		{
    			cout<<a[i][j]<<" ";
    		}
    	}
    	cout<<endl;
    }
    
    return 0;
    

    }

    • 2
      @ 2025-3-25 18:05:37

      #include<bits/stdc++.h> using namespace std; int main(){ float t,n;cin>>t>>n; printf("%.3f",t/n); cout<<endl<<2*n; return 0; }

      • 1
        @ 2025-10-29 17:17:05

        66666666666

        • 1
          @ 2025-4-18 16:51:34

          #include<bits/stdc++.h> using namespace std; int main(){ float t,n;cin>>t>>n; printf("%.3f",t/n); cout<<endl<<2*n; return 0; }

          • 1
            @ 2025-3-28 17:39:05
            #include<bits/stdc++.h>
            using namespace std;
            int main(){
            	float t,n;cin>>t>>n;
            	printf("%.3f",t/n);
            	cout<<endl<<2*n;
            	return 0;
            }
            
            
            
            • 1

            Information

            ID
            1327
            Time
            1000ms
            Memory
            256MiB
            Difficulty
            6
            Tags
            (None)
            # Submissions
            124
            Accepted
            42
            Uploaded By