Codeforces 1807 b. grab the candies Solution

codeforces 1807 b. grab the candies solution

problem question link Grab the Candies solution B. Grab the Candies Mihai and Bianca are playing with bags of candies. They have a row a� of n� bags of candies. The i�-th bag has ai�� candies. The bags are given to the players in the order from the first bag to the n�-th bag. If a bag has an even number of candies, … Read more

Codeforces1807A. Plus or Minus Solution

Codeforces1807A. Plus or Minus(Div 4) Problem Question In this guide, we will explore the A Plus or Minus problem, a classic problem in computer programming that requires you to calculate the sum of a series of integers, with each integer being either positive or negative. We will walk you through the process of solving this … Read more

Codeforces 110A Nearly Lucky Number Solution in CPP

Codeforces 110A Nearly Lucky Number Solution

Question link: Codeforces 110A Nearly Lucky Number solution in CPP #include<bits/stdc++.h> using namespace std; int main() { string a; int c=0,z=0; cin>>a; for(int i=0;i<a.size();i++) { if(a[i]==’4’||a[i]==’7′)//Codeforces 110A Nearly Lucky Number solution in CPP c++; } if(c==4||c==7) cout<<“YES”<<endl; else cout<<“NO”<<endl; } Codeforces 734A.Anton and Danik solution in Cpp

Codeforces 977A Wrong Subtraction solution in CPP

Codeforces 977A Wrong Subtraction solution in CPP

Question link: Codeforces 977A Wrong Subtraction solution in CPP Wrong Subtraction #include<bits/stdc++.h> using namespace std; int main() { int n,k,r=0; cin>>n>>k; for(int i=1;i<=k;i++) { r=n%10; if(r==0) { n/=10; } else { n=n-1; } } cout<<n; } Code Explanation This is a C++ code that takes two integers n and k as input from the user, … Read more

Elephant Codeforces || Codeforces 617A Elephant solution in C++

Elephant Codeforces

Codeforces Elephant Question Elephant Codeforces solution in C++ An elephant decided to visit his friend. It turned out that the elephant’s house is located at point 0 and his friend’s house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions forward. Determine, what is the minimum number of steps he need to … Read more

Codeforces 546A Soldier and Bananas solution in C++

Codeforces 546A Soldier and Bananas solution in C++

Codeforces 546A. Soldier and Bananas Question A. Soldier and Bananas A soldier wants to buy w bananas in the shop. He has to pay k dollars for the first banana, 2k dollars for the second one and so on (in other words, he has to pay i·k dollars for the i-th banana). He has n dollars. How many dollars does he have to borrow from his … Read more

Stones On The Table Codeforces Solution || Codeforces 266A

Stones On The Table Codeforces Solution

Question Stones on the Table Codeforces Solution in C++ Problem:There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring … Read more

Codeforces Bear and Big Brother solution

Codeforces Problem 791/A. Bear and Big Brother solution with CPP

Codeforces Problem 791/A. Bear and Big Brother solution with CPP 100% Accepted Before seeking assistance, it is advisable to make an effort to solve the problem yourself. This can involve researching the problem online, reviewing relevant documentation, and attempting to apply your knowledge to find a solution. By trying to solve the problem first, you … Read more

Word capitalization codeforces solution

word capitalization codeforces solution

Word capitalization codeforces solution Codeforces 281A. Word Capitalization Solution in C #include <stdio.h> #include <string.h> int main() { char s[101]; scanf(“%s”, s); s[0] = toupper(s[0]); printf(“%s\n”, s); return 0; } Codeforces 281A. Word Capitalization Solution in CPP #include<iostream> #include<string>using namespace std; int main() { string s; cin>>s; s[0]=towupper(s[0]); cout<<s; } Codeforces 791/A. Bear and Big … Read more

Domino Piling solution in C | Codeforces 50A. Domino piling solution

domino piling solution in c

Domino Piling Solution in C | Codeforces 50A. Domino piling solution Question A. Domino piling You are given a rectangular board of M × N squares. Also you are given an unlimited number of standard domino pieces of 2 × 1 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possible on the board so … Read more