Round G 2022 - Kick Start 2022 Walktober Problem (C Code)

// Below is the Solution of the Round G 2022 -kickstart 2022 :) 

// Contact me if any question persist in your mind, I'm ready to help you :) 

// HAPPY CODING

#include <stdio.h>

int main(){

    int t,count=0;

    scanf("%d",&t);

    while(t--){

        int M,N,P,k=0,i,j;

        scanf("%d%d%d",&M,&N,&P);

        int max[N],pl[N],n[N];

        for(i=0;i<N;i++)

        max[i]=0;

        for(i=0;i<M;i++){

            for(j=0;j<N;j++){

                scanf("%d",&n[j]);

                if((i+1)!=P){

                if(max[j]<n[j])

                max[j]=n[j];

                }

                else{

                    pl[j]=n[j];

                }

            }

        }

        int ans=0;

        for(i=0;i<N;i++){

            if(max[i]>pl[i])

            ans+=(max[i]-pl[i]);

            else

            ans+=0;

        }

        printf("Case #%d: %d\n",++count,ans);

    }

    return 0;

}

No comments:

Post a Comment

Operator Overloading in C++

#include<iostream> using namespace std; class Complex { private: int real, imag; public: Complex(int r = 0, int i = 0){       re...