Please Install our Kuizzer app ! ---- Doesn't Know how to install click here!

Codechef Practice | Week 3

CODECHEF SOLUTION

Week 2 link: Chandigarh University – Practice – Week 2 Coding Competition | CodeChef

1. Enormous Input Test: INTEST

link: Enormous Input Test – Submit

// THIS code starts from INT MAIN so copy paste from here only

#include<iostream>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n,k;
    cin >> n >> k;

    int count=0;
    for (int i=0;i <=n-1;i++)
    {
        int a;
        cin >> a;
        if (a%k==0)
        {
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

2. Decrement OR Increment : DECINC

link: Decrement OR Increment – Submit

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int n;
	cin>>n;
	
	if(n%4==0)
	cout << n+1 << endl;
	else
	cout << n-1 << endl;
	return 0;
}

3. Chef And Operators: CHOPRT


link: Chef And Operators – Submit

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t , x ,y ;
	cin >>t ;
	while(t--) {
	    cin >> x >>y ;
	    if ( x >y )
	    cout << ">" << endl ;
	    else if ( x < y ) 
	    cout << "<" << endl ;
	    else 
	    cout << "=" << endl ;
	}
	return 0;
}

4. Sum OR Difference: DIFFSUM

link: Sum OR Difference – Submit

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	 int a,b;
    cin>>a>>b;
    if(a>b)
    cout << a-b;
    else
    cout << a+b;
	return 0;
}

5. ATM Problem : HS08TEST

link: ATM – Submit

#include<iostream>
using namespace std;

int main() {
    int w;
    float ac_bl;
    cin>>w;
    cin>>ac_bl;
    if(w%5==0 && w < =ac_bl-0.5){
        cout << ((ac_bl-w)-(0.5));
    }
    else{
        cout << ac_bl;
    }
	return 0;
}

* The material and content uploaded on this website are for general information and reference purposes only and don’t copy the answers of this website to any other domain without any permission or else copyright abuse will be in action.

Please do it by your own first!

DMCA.com Protection Status

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
KUIZZER Helping Educational website for Youngers

Welcome To Kuizzer!

KUIZZER - Helping Educational Website for YoungersYour Post is going to visible like this

Here, Your Promotional Details are going to visible for others whenever they visit the site !

AdBlock Detected

Looks like you are using an ad-blocking browser extension. We request you to whitelist our website on the ad-blocking extension and refresh your browser to view the content.

Check out our merchandise, available at kuizzer.in

X
0
Would love your thoughts, please comment.x
()
x