1 solutions

  • 0
    @ 2024-4-8 12:11:09
    #include <iostream>
     using namespace std; 
     const int MAXN = 1e3 + 5; 
    int n,m,q,x,y,z;  
    long long a[MAXN]; long long b[MAXN][MAXN];  
     long long calc(int t,int k){	
    long long res = a[k]; 
    	for (int i=1;i<=t;i++) 	
                     res += b[k][i]; 
      	return res; 
    }  
    int main(){ 	
    cin >> n >> m >> q; 
    	for (int i=1;i<=n;i++) 
    		cin >> a[i]; 
    	 	for (int i=1;i<=m;i++) 
    		for (int j=1;j<=n;j++) 			
    cin >> b[j][i]; 	 	
    while (q--){ 		
                    cin >> x >> y >> z; 
    		cout << calc(x,y) - calc(x,z) << endl;  	                
    }
    }
    
    • 1

    Information

    ID
    9543
    Time
    1000ms
    Memory
    512MiB
    Difficulty
    1
    Tags
    # Submissions
    43
    Accepted
    35
    Uploaded By